samedi 23 juillet 2016

Access several columns in an array in Python

I'm new to python and numpy. Suppose I have an array A = np.random.rand(10,100) , how do i access some of its columns easily?

In Matlab I would write something like B = A(:,[2,4,6:10,50:80]). What is the equivalent of this line of code in Python?

I've looked at the examples in http://scipy.github.io/old-wiki/pages/NumPy_for_Matlab_Users.html but none of them answer my question.

Aucun commentaire:

Enregistrer un commentaire