[Numpy-discussion] Preventing an ndarray subclass from returning new subclass instances for std(), etc
pgmdevlist at gmail.com
Sun Sep 18 16:25:31 EDT 2011
On Sep 18, 2011, at 21:25 , Stéfan van der Walt wrote:
> On Sun, Sep 18, 2011 at 9:48 AM, Keith Hughitt <keith.hughitt at gmail.com> wrote:
>> Interesting. It works as expected when called as a method:
>> In : x = np.ma.array([[1,2,3]])
>> In : x.std()
>> Out: 0.81649658092772603
> I'm guessing that np.ma.array implements its own std function, but I
> haven't checked.
It does. np.std tries first to call the .std method of the input argument.
More information about the NumPy-Discussion