|
93 | 93 | class MaskedArrayFutureWarning(FutureWarning):
|
94 | 94 | pass
|
95 | 95 |
|
96 |
| -def _deprecate_argsort_axis(arr, axis): |
97 |
| - """ |
98 |
| - Takes the array argsort was called upon, and the axis argument |
99 |
| - it was called with. |
100 |
| -
|
101 |
| - np.ma.argsort has a long-term bug where the default of the axis argument |
102 |
| - is wrong (gh-8701), which now must be kept for backwards compatibiity. |
103 |
| - Thankfully, this only makes a difference when arrays are 2- or more- |
104 |
| - dimensional, so we only need a warning then. |
105 |
| - """ |
106 |
| - if axis is np._NoValue: |
107 |
| - if arr.ndim <= 1: |
108 |
| - # no warning needed - switch to -1 to avoid surprising subclasses |
109 |
| - return -1 |
110 |
| - else: |
111 |
| - # 2017-04-10, numpy 1.13.0 |
112 |
| - warnings.warn( |
113 |
| - "Unlike np.argsort, np.sort, np.ma.sort, and the " |
114 |
| - "documentation for this function, the default is " |
115 |
| - "axis=None, not axis=-1. In future, the default will be " |
116 |
| - "-1. To squash this warning, specify the axis argument " |
117 |
| - "explicitly.", |
118 |
| - MaskedArrayFutureWarning, stacklevel=2) |
119 |
| - return None |
120 |
| - else: |
121 |
| - return axis |
122 |
| - |
123 | 96 |
|
124 | 97 | def doc_note(initialdoc, note):
|
125 | 98 | """
|
@@ -5255,7 +5228,7 @@ def round(self, decimals=0, out=None):
|
5255 | 5228 | out.__setmask__(self._mask)
|
5256 | 5229 | return out
|
5257 | 5230 |
|
5258 |
| - def argsort(self, axis=np._NoValue, kind='quicksort', order=None, |
| 5231 | + def argsort(self, axis=-1, kind='quicksort', order=None, |
5259 | 5232 | endwith=True, fill_value=None):
|
5260 | 5233 | """
|
5261 | 5234 | Return an ndarray of indices that sort the array along the
|
@@ -5311,8 +5284,6 @@ def argsort(self, axis=np._NoValue, kind='quicksort', order=None,
|
5311 | 5284 |
|
5312 | 5285 | """
|
5313 | 5286 |
|
5314 |
| - axis = _deprecate_argsort_axis(self, axis) |
5315 |
| - |
5316 | 5287 | if fill_value is None:
|
5317 | 5288 | if endwith:
|
5318 | 5289 | # nan > inf
|
@@ -6532,10 +6503,9 @@ def power(a, b, third=None):
|
6532 | 6503 | argmin = _frommethod('argmin')
|
6533 | 6504 | argmax = _frommethod('argmax')
|
6534 | 6505 |
|
6535 |
| -def argsort(a, axis=np._NoValue, kind='quicksort', order=None, endwith=True, fill_value=None): |
| 6506 | +def argsort(a, axis=-1, kind='quicksort', order=None, endwith=True, fill_value=None): |
6536 | 6507 | "Function version of the eponymous method."
|
6537 | 6508 | a = np.asanyarray(a)
|
6538 |
| - axis = _deprecate_argsort_axis(a, axis) |
6539 | 6509 |
|
6540 | 6510 | if isinstance(a, MaskedArray):
|
6541 | 6511 | return a.argsort(axis=axis, kind=kind, order=order,
|
|
0 commit comments