Skip to content

Odd behavior with masked array sum() #11736

@dopplershift

Description

@dopplershift

Reproducing code example:

import numpy as np
a = np.ma.array([10])
a[a < 0].sum()

Prints 0.0. But

import numpy as np
a = np.ma.array([10], mask=False)
a[a < 0].sum()

Prints masked. Huh?

Numpy/Python version information:

1.15.0 3.6.6 | packaged by conda-forge | (default, Jul 26 2018, 09:55:02) [GCC 4.2.1 Compatible Apple LLVM 6.1.0 (clang-602.0.53)]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions