Return a sorted copy of the masked array. Equivalent to creating a copy of the array and applying the MaskedArray ``sort()`` method. Refer to ``MaskedArray.sort`` for the full documentation See Also -------- MaskedArray.sort : equivalent method Examples ----
(a, axis=-1, kind=None, order=None, endwith=True, fill_value=None, *,
stable=None, descending=None)
| 7230 | argsort.__doc__ = MaskedArray.argsort.__doc__ |
| 7231 | |
| 7232 | def sort(a, axis=-1, kind=None, order=None, endwith=True, fill_value=None, *, |
| 7233 | stable=None, descending=None): |
| 7234 | """ |
| 7235 | Return a sorted copy of the masked array. |
| 7236 | |
| 7237 | Equivalent to creating a copy of the array |
| 7238 | and applying the MaskedArray ``sort()`` method. |
| 7239 | |
| 7240 | Refer to ``MaskedArray.sort`` for the full documentation |
| 7241 | |
| 7242 | See Also |
| 7243 | -------- |
| 7244 | MaskedArray.sort : equivalent method |
| 7245 | |
| 7246 | Examples |
| 7247 | -------- |
| 7248 | >>> import numpy as np |
| 7249 | >>> import numpy.ma as ma |
| 7250 | >>> x = [11.2, -3.973, 0.801, -1.41] |
| 7251 | >>> mask = [0, 0, 0, 1] |
| 7252 | >>> masked_x = ma.masked_array(x, mask) |
| 7253 | >>> masked_x |
| 7254 | masked_array(data=[11.2, -3.973, 0.801, --], |
| 7255 | mask=[False, False, False, True], |
| 7256 | fill_value=1e+20) |
| 7257 | >>> ma.sort(masked_x) |
| 7258 | masked_array(data=[-3.973, 0.801, 11.2, --], |
| 7259 | mask=[False, False, False, True], |
| 7260 | fill_value=1e+20) |
| 7261 | """ |
| 7262 | a = np.array(a, copy=True, subok=True) |
| 7263 | if axis is None: |
| 7264 | a = a.flatten() |
| 7265 | axis = 0 |
| 7266 | |
| 7267 | if isinstance(a, MaskedArray): |
| 7268 | a.sort(axis=axis, kind=kind, order=order, endwith=endwith, |
| 7269 | fill_value=fill_value, stable=stable, descending=descending) |
| 7270 | else: |
| 7271 | a.sort(axis=axis, kind=kind, order=order, stable=stable, descending=descending) |
| 7272 | return a |
| 7273 | |
| 7274 | |
| 7275 | def compressed(x): |
searching dependent graphs…