MCPcopy Index your code
hub / github.com/numpy/numpy / _deprecate_argsort_axis

Function _deprecate_argsort_axis

numpy/ma/core.py:93–118  ·  view source on GitHub ↗

Adjust the axis passed to argsort, warning if necessary Parameters ---------- arr The array which argsort was called on np.ma.argsort has a long-term bug where the default of the axis argument is wrong (gh-8701), which now must be kept for backwards compatibility.

(arr)

Source from the content-addressed store, hash-verified

91 pass
92
93def _deprecate_argsort_axis(arr):
94 """
95 Adjust the axis passed to argsort, warning if necessary
96
97 Parameters
98 ----------
99 arr
100 The array which argsort was called on
101
102 np.ma.argsort has a long-term bug where the default of the axis argument
103 is wrong (gh-8701), which now must be kept for backwards compatibility.
104 Thankfully, this only makes a difference when arrays are 2- or more-
105 dimensional, so we only need a warning then.
106 """
107 if arr.ndim <= 1:
108 # no warning needed - but switch to -1 anyway, to avoid surprising
109 # subclasses, which are more likely to implement scalar axes.
110 return -1
111 else:
112 # 2017-04-11, Numpy 1.13.0, gh-8701: warn on axis default
113 warnings.warn(
114 "In the future the default for argsort will be axis=-1, not the "
115 "current None, to match its documentation and np.argsort. "
116 "Explicitly pass -1 or None to silence this warning.",
117 MaskedArrayFutureWarning, stacklevel=3)
118 return None
119
120
121def doc_note(initialdoc, note):

Callers 2

argsortMethod · 0.85
argsortFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…