[SciPy-user] Operations on Arrays in SciPy

Robert Kern robert.kern at gmail.com
Tue Dec 11 16:19:32 EST 2007


Lorenzo Isella wrote:
> Dear All,
> A  probably quick question:  SciPy's arrays are objects  with methods, 
> are they not?

Yes.

> For instance,  consider the following:
> import scipy as s
> z=s.arange(30)
> mean_z=s.mean(z)
> mean_z_2=z.mean()
> 
> Is there a reason why one way of operating on the array should be 
> preferable?

scipy.mean() can accept anything that can be converted to an array, like a list
of numbers.

> Is it the same thing to work out the mean of z as mean_z or mean_z_2?

Yes.

-- 
Robert Kern

"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 mailing list