[Numpy-discussion] Adding a 2D with a 1D array...
Wed Sep 9 06:08:22 CDT 2009
Perfect! Thank you very much :D
It's not obvious, though...I think I should read more deeply into
Python/NumPy...but for the use I'm giving to it...
Anyway, I thought the pythonic way would be faster, but after trying with a
size 80000 instead of 8...the for loop is faster!
Pythonic time ==> 0.36776400 seconds
For loop time ==> 0.31708717 seconds
On Wed, Sep 9, 2009 at 12:46 PM, Citi, Luca <firstname.lastname@example.org> wrote:
> 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]
> NumPy-Discussion mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion