[SciPy-user] Mean / std type conversion ?

Stef Mientki stef.mientki@gmail....
Thu May 22 16:36:56 CDT 2008


Robert Kern wrote:
> On Thu, May 22, 2008 at 3:29 PM, Stef Mientki <s.mientki@ru.nl> wrote:
>   
>> hello,
>>
>> The following lines 1,2 don't work as I expect,
>> lines 3,4 works correctly...
>>
>>        print numpy.mean ( data, 0, dtype = int )
>>        print numpy.std  ( data, 0, int )
>>        print numpy.mean ( data, 0 ).astype ( int )
>>        print numpy.std  ( data, 0 ).astype ( int )
>>
>> Am I doing something wrong (numpy 1.0.4) ?
>>     
>
> Yes. 1,2 mean something entirely different than 3,4. They do not
> specify the type of the output but rather the type of the accumulator.
> This allows one to specify an accumulator type larger than the array's
> type to avoid overflow.
>
>   
>> Another question,
>> isn't there a function that computes both mean and std ?
>>     
>
> No.
>
>   
thanks Robert,
that explains.

cheers,
Stef


More information about the SciPy-user mailing list