10000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
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
Right now, the default arguments for sorting-related methods are:
Defaults to axis=-1:
axis=-1
np.sort
np.ndarray.sort
np.argsort
np.ndarray.argsort
np.ma.sort
np.masked_array.sort
np.ma.argsort
np.masked_array.argsort
Defaults to axis=None:
axis=None
For 1D arrays, there is no difference, as None just means flatten and use the only axis.
None
For 2D arrays, however, code written for ndarrays can fail in unexpected ways when passed a masked_array, because argsort breaks liskov subsitution:
ndarrays
masked_array
argsort
def foo(x): i = x.argsort() assert(i.shape == x.shape) >>> foo(som_arr) # ok >>> foo(som_arr.view(MaskedArray)) # AssertionError
The text was updated successfully, but these errors were encountered:
DEP: deprecate calling ma.argsort without an axis
1075c1d
Only deprecated when this would be ambiguous. Approaches numpy#8701
API: Change default axis argument for argsort
4d30cff
Now matches: * its own documentation * everything else Fixes numpy#8701
0a8ee4c
1739618
No branches or pull requests
Uh oh!
There was an error while loading. Please reload this page.
Right now, the default arguments for sorting-related methods are:
Defaults to
axis=-1
:np.sort
np.ndarray.sort
np.argsort
np.ndarray.argsort
np.ma.sort
np.masked_array.sort
np.ma.argsort
np.masked_array.argsort
Defaults to
axis=None
:np.ma.argsort
np.masked_array.argsort
For 1D arrays, there is no difference, as
None
just means flatten and use the only axis.For 2D arrays, however, code written for
ndarrays
can fail in unexpected ways when passed amasked_array
, becauseargsort
breaks liskov subsitution:The text was updated successfully, but these errors were encountered: