[Numpy-discussion] out= corner cases

Keith Goodman kwgoodman@gmail....
Thu May 29 10:57:25 CDT 2008


This looks good:

>> import numpy as np
>> x = np.random.rand(2,3)
>> x.mean(None, out=x)
---------------------------------------------------------------------------
ValueError: wrong shape for output

But this is strange:

>> x.std(None, out=x)
   0.28264369725
>> x

array([[ 0.54718012,  0.94296181,  0.23668961],
       [ 0.35561918,  0.80860405,  0.96713833]])
>>
>> x.var(None, out=x)
   0.0798874595952
>> x

array([[ 0.54718012,  0.94296181,  0.23668961],
       [ 0.35561918,  0.80860405,  0.96713833]])
>>
>> x.var(0, out=x)
   array([ 0.0091739 ,  0.004513  ,  0.13338883])
>> x

array([[ 0.54718012,  0.94296181,  0.23668961],
       [ 0.35561918,  0.80860405,  0.96713833]])

I'm using numpy 1.0.4 from Debian Lenny.


More information about the Numpy-discussion mailing list