Skip to content

BUG: Many ndarray methods are not specialized for ma.MaskedArray  #4356

@abalkin

Description

@abalkin

Since ma.MaskedArray inherits from ndarray, all ndarray methods are inherited, but with exception of ufuncs, such inheritance is ill-advised and may lead to silent data corruption:

>>> x = ma.masked_all(5)
>>> x.item(0)
-1.2882297539194267e-231

The list of such methods includes:

  1. choose
  2. dumps
  3. dump
  4. item
  5. partition
  6. argpartition
  7. fill
  8. searchsorted
  9. dot

I would classify this issue as a bug, but a fix can be as simple as making these methods raise NotImplementedError.

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