Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6472813

Browse files
authored
Merge pull request #13222 from kritisingh1/patch1
DOC: Document/ Deprecate functions exposed in "numpy" namespace
2 parents 0b43174 + 13561bd commit 6472813

File tree

4 files changed

+80
-64
lines changed

4 files changed

+80
-64
lines changed

doc/source/user/basics.io.genfromtxt.rst

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -521,12 +521,6 @@ provides several convenience functions derived from
521521
:func:`~numpy.genfromtxt`. These functions work the same way as the
522522
original, but they have different default values.
523523

524-
:func:`~numpy.ndfromtxt`
525-
Always set ``usemask=False``.
526-
The output is always a standard :class:`numpy.ndarray`.
527-
:func:`~numpy.mafromtxt`
528-
Always set ``usemask=True``.
529-
The output is always a :class:`~numpy.ma.MaskedArray`
530524
:func:`~numpy.recfromtxt`
531525
Returns a standard :class:`numpy.recarray` (if ``usemask=False``) or a
532526
:class:`~numpy.ma.MaskedRecords` array (if ``usemaske=True``). The

numpy/lib/npyio.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2244,6 +2244,12 @@ def ndfromtxt(fname, **kwargs):
22442244
"""
22452245
Load ASCII data stored in a file and return it as a single array.
22462246
2247+
.. deprecated:: 1.17
2248+
ndfromtxt` is a deprecated alias of `genfromtxt` which
2249+
overwrites the ``usemask`` argument with `False` even when
2250+
explicitly called as ``ndfromtxt(..., usemask=True)``.
2251+
Use `genfromtxt` instead.
2252+
22472253
Parameters
22482254
----------
22492255
fname, kwargs : For a description of input parameters, see `genfromtxt`.
@@ -2254,13 +2260,24 @@ def ndfromtxt(fname, **kwargs):
22542260
22552261
"""
22562262
kwargs['usemask'] = False
2263+
# Numpy 1.17
2264+
warnings.warn(
2265+
"np.ndfromtxt is a deprecated alias of np.genfromtxt, "
2266+
"prefer the latter.",
2267+
DeprecationWarning, stacklevel=2)
22572268
return genfromtxt(fname, **kwargs)
22582269

22592270

22602271
def mafromtxt(fname, **kwargs):
22612272
"""
22622273
Load ASCII data stored in a text file and return a masked array.
22632274
2275+
.. deprecated:: 1.17
2276+
np.mafromtxt is a deprecated alias of `genfromtxt` which
2277+
overwrites the ``usemask`` argument with `True` even when
2278+
explicitly called as ``mafromtxt(..., usemask=False)``.
2279+
Use `genfromtxt` instead.
2280+
22642281
Parameters
22652282
----------
22662283
fname, kwargs : For a description of input parameters, see `genfromtxt`.
@@ -2271,6 +2288,11 @@ def mafromtxt(fname, **kwargs):
22712288
22722289
"""
22732290
kwargs['usemask'] = True
2291+
# Numpy 1.17
2292+
warnings.warn(
2293+
"np.mafromtxt is a deprecated alias of np.genfromtxt, "
2294+
"prefer the latter.",
2295+
DeprecationWarning, stacklevel=2)
22742296
return genfromtxt(fname, **kwargs)
22752297

22762298

0 commit comments

Comments
 (0)