[SciPy-user] Mean / std type conversion ?
Thu May 22 15:37:22 CDT 2008
On Thu, May 22, 2008 at 3:29 PM, Stef Mientki <firstname.lastname@example.org> wrote:
> 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 ?
"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
-- Umberto Eco
More information about the SciPy-user