Skip to content

BUG: np.ma.array has surprising default arguments when compared to np.array #10318

Open
@eric-wieser

Description

@eric-wieser

Spot the odd one out:

  • np.array defaults to copy=True, subok=False
  • np.ma.array defaults to copy=False, subok=True
  • np.asarray defaults to copy=False, subok=False
  • np.ma.asarray defaults to copy=False, subok=False
  • np.asanyarray defaults to copy=False, subok=True
  • np.ma.asanyarray defaults to copy=False, subok=True

So as a result, np.ma.asanyarray and np.ma.array are exactly the same.
More confusingly, np.ma.asarray is stricter than np.ma.array, not less strict!

I don't know if there's any way we can fix this without breaking downstream code, but it seems like a poor design decision - and violates the expectation that np.ma.func and np.func are similar.

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