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

Citi, Luca lciti at essex.ac.uk
Wed Sep 9 06:46:59 EDT 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]

Best,
Luca



More information about the NumPy-Discussion mailing list