diff options
author | Eric Wieser <wieser.eric@gmail.com> | 2019-11-27 23:17:29 +0000 |
---|---|---|
committer | Sebastian Berg <sebastian@sipsolutions.net> | 2019-12-02 12:39:08 -0600 |
commit | 14bcfd9cfe0deb4e6499b398d7eba4d7e3dd7fe8 (patch) | |
tree | 3207856bd571ea24b16a0c66014c8c4e78eb1ca0 /numpy/ma/extras.py | |
parent | d1d9dd58e2de5f3b69c02b104e1daaeec1f38d9f (diff) | |
download | numpy-14bcfd9cfe0deb4e6499b398d7eba4d7e3dd7fe8.tar.gz |
DEP: Deprecate the axis argument to masked_rows and masked_cols
This argument isn't used, and is confusing. (Small test added by
seberg)
Diffstat (limited to 'numpy/ma/extras.py')
-rw-r--r-- | numpy/ma/extras.py | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/numpy/ma/extras.py b/numpy/ma/extras.py index 4a83ac781..f4a914471 100644 --- a/numpy/ma/extras.py +++ b/numpy/ma/extras.py @@ -937,7 +937,7 @@ def compress_cols(a): raise NotImplementedError("compress_cols works for 2D arrays only.") return compress_rowcols(a, 1) -def mask_rows(a, axis=None): +def mask_rows(a, axis=np._NoValue): """ Mask rows of a 2D array that contain masked values. @@ -979,9 +979,15 @@ def mask_rows(a, axis=None): fill_value=1) """ + if axis is not np._NoValue: + # remove the axis argument when this deprecation expires + # NumPy 1.18.0, 2019-11-28 + warnings.warn( + "The axis argument has always been ignored, in future passing it " + "will raise TypeError", DeprecationWarning, stacklevel=2) return mask_rowcols(a, 0) -def mask_cols(a, axis=None): +def mask_cols(a, axis=np._NoValue): """ Mask columns of a 2D array that contain masked values. @@ -1022,6 +1028,12 @@ def mask_cols(a, axis=None): fill_value=1) """ + if axis is not np._NoValue: + # remove the axis argument when this deprecation expires + # NumPy 1.18.0, 2019-11-28 + warnings.warn( + "The axis argument has always been ignored, in future passing it " + "will raise TypeError", DeprecationWarning, stacklevel=2) return mask_rowcols(a, 1) |