[Numpy-discussion] buggy buggy bugyy: format and casting ==> BUG in numpy.sum?

Sven Schreiber svetosch at gmx.net
Mon Sep 18 05:20:49 CDT 2006


Eric Emsellem schrieb:
> Hi again
> 
> after some hours of debugging I finally (I think) found the problem:
> 
> numpy.sum([[0,1,2],[2,3,4]])
> 24
> 
> numpy.sum([[0,1,2],[2,3,4]],axis=0)
> array([2, 4, 6])
> 
> numpy.sum([[0,1,2],[2,3,4]],axis=1)
> array([3, 9])
> 
> 
> Isn't the first line supposed to act as with "axis=0" by default (see
> help numpy.sum!)...???
> Not setting axis=0 it sums everything!

The default axis was changed recently to None (btw, which version are
you using?), see the release notes on the web. So yes, it's expected.
> 
> Is that the expected behaviour or is the doc not updated? (I realise it
> may be better to force axis=.. to indicate what you need but still.. the
> example in numpy.sum help gives:
> sum([[0, 1], [0, 5]])
>     array([0, 6]) which is not what it gives when you do it...)

on my 1.0b5 I also see this docstring which indeed seems obsolete. Has
it been changed since then? (And similarly for the other
functions/methods where axis arguments have changed.)

I could check the docstrings systematically and update them, but
unfortunately not before the end of this month, sorry.

cheers,
sven




More information about the Numpy-discussion mailing list