[Numpy-discussion] basic question about numpy arrays

Rob Speer rspeer@MIT....
Mon Aug 16 13:35:36 CDT 2010

To explain:

A has shape (2,1), meaning it's a 2-D array with 2 rows and 1 column.
The transpose of A has shape (1,2): it's a 2-D array with 1 row and 2
columns. That's not the same as what you want, which is an array with
shape (2,): a 1-D array with 2 entries.

When you take A[:,0], you're pulling out the 1-D array that
constitutes column 0 of your array, which is exactly what you want.

-- Rob

More information about the NumPy-Discussion mailing list