[Numpy-discussion] Adding a 2D with a 1D array...

Citi, Luca lciti@essex.ac...
Wed Sep 9 05:46:59 CDT 2009

Hi Ruben

One dimensional arrays can be thought of as rows. If you want a column, you need to append a dimension.

>>> d = a + b[:,None]
which is equivalent to 
>>> d = a + b[:,np.newaxis]


More information about the NumPy-Discussion mailing list