Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOC: Fix module setting of MaskedArray #25972

Merged
merged 1 commit into from
Mar 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
DOC: Fix module setting of MaskedArray
Set module of ``MaskedArray`` to ``numpy.ma`` because
``numpy.ma.core.MaskedArray`` is an internal alias not documented.

ref: gh-13114

[skip cirrus] [skip azp] [skip actions]
  • Loading branch information
koyuki7w committed Mar 9, 2024
commit 7b9dede257171bdfafdd4a6fa43ac4df806b1103
8 changes: 5 additions & 3 deletions numpy/ma/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
from numpy import array as narray, expand_dims, iinfo, finfo
from numpy._core.numeric import normalize_axis_tuple
from numpy._utils._inspect import getargspec, formatargspec
from numpy._utils import set_module


__all__ = [
Expand Down Expand Up @@ -2636,7 +2637,7 @@ class MaskedIterator:
>>> x = np.ma.array(arange(6).reshape(2, 3))
>>> fl = x.flat
>>> type(fl)
<class 'numpy.ma.core.MaskedIterator'>
<class 'numpy.ma.MaskedIterator'>
>>> for item in fl:
... print(item)
...
Expand Down Expand Up @@ -2717,6 +2718,7 @@ def __next__(self):
return d


@set_module("numpy.ma")
class MaskedArray(ndarray):
"""
An array class with possibly masked values.
Expand Down Expand Up @@ -8378,7 +8380,7 @@ def asarray(a, dtype=None, order=None):
mask=False,
fill_value=1e+20)
>>> type(np.ma.asarray(x))
<class 'numpy.ma.core.MaskedArray'>
<class 'numpy.ma.MaskedArray'>

"""
order = order or 'C'
Expand Down Expand Up @@ -8425,7 +8427,7 @@ def asanyarray(a, dtype=None):
mask=False,
fill_value=1e+20)
>>> type(np.ma.asanyarray(x))
<class 'numpy.ma.core.MaskedArray'>
<class 'numpy.ma.MaskedArray'>

"""
# workaround for #8666, to preserve identity. Ideally the bottom line
Expand Down
Loading