Hi there!

I'm sure I'm missing something, but I am not able of doing a simple sum of
two arrays with different dimensions. I have a 2D array and a 1D array

np.shape(a) (8, 26)
np.shape(b) (8,)

and I want to sum each *row* of 'a' with the equivalent *row* of 'b' (this
is, summing each 1D row array of 'a' with each scalar of 'b' for all rows).
It's straight forward doing the sum with a for loop (yes, I learnt C long
ago :S ):

for i in range(8):
    c[i] = a[i] + b[i]

but, is there a Pythonic way to do this? or even better...which is the
pythonic way of doing it? because I'm sure there is one...

Thanks, and sorry for such an easy question...but I'm stuck
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to