numpy.ma.sort#
- ma.sort(a, axis=-1, kind=None, order=None, endwith=True, fill_value=None, *, stable=None)[源代码]#
返回一个已排序的掩码数组的副本.
相当于创建数组的副本并应用 MaskedArray 的
sort()
方法.请参阅
MaskedArray.sort
以获取完整文档参见
MaskedArray.sort
等效方法
示例
>>> import numpy as np >>> import numpy.ma as ma >>> x = [11.2, -3.973, 0.801, -1.41] >>> mask = [0, 0, 0, 1] >>> masked_x = ma.masked_array(x, mask) >>> masked_x masked_array(data=[11.2, -3.973, 0.801, --], mask=[False, False, False, True], fill_value=1e+20) >>> ma.sort(masked_x) masked_array(data=[-3.973, 0.801, 11.2, --], mask=[False, False, False, True], fill_value=1e+20)