[Numpy-discussion] Extracting individual columns in Numpy

Andrew Nelson andyfaff at gmail.com
Thu Oct 9 01:55:38 EDT 2014

>import numpy as np
a = np.array([[1,2,3],[4,5,6],[7,8,9]])

Now both a[:][0] and a[0][:] are outputting the same result, i.e
np.array([1,2,3]). If I want to extract the array [[1],[4],[7]] then
what should I do? Is it possible to add this feature?

The feature is already there:
a[:, 0]

Dr. Andrew Nelson

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20141009/9567b30d/attachment.html>

More information about the NumPy-Discussion mailing list