排序,搜索和计数(Sorting, searching, and counting
)
排序(Sorting
)
method |
description |
sort(a[, axis, kind, order]) |
返回数组的排序副本。 |
lexsort(keys[, axis]) |
使用键的序列执行间接稳定排序。 |
argsort(a[, axis, kind, order]) |
返回将对数组进行排序的索引。 |
ndarray.sort([axis, kind, order]) |
就地排序数组。 |
msort(a) |
返回沿第一个指针排序的数组的副本。 |
sort_complex(a) |
首先使用实部,然后使用虚部对复杂数组进行排序。 |
partition(a, kth[, axis, kind, order]) |
返回数组的分区副本。 |
argpartition(a, kth[, axis, kind, order]) |
使用kind关键字指定的算法,沿给定的指针执行间接分区。 |
Searching
method |
description |
argmax(a[, axis, out]) |
Returns the indices of the maximum values along an axis. |
nanargmax(a[, axis]) |
Return the indices of the maximum values in the specified axis ignoring NaNs. |
argmin(a[, axis, out]) |
Returns the indices of the minimum values along an axis. |
nanargmin(a[, axis]) |
Return the indices of the minimum values in the specified axis ignoring NaNs. |
argwhere(a) |
Find the indices of array elements that are non-zero, grouped by element. |
nonzero(a) |
Return the indices of the elements that are non-zero. |
flatnonzero(a) |
Return indices that are non-zero in the flattened version of a. |
where(condition, [x, y]) |
Return elements chosen from x or y depending on condition. |
searchsorted(a, v[, side, sorter]) |
Find indices where elements should be inserted to maintain order. |
extract(condition, arr) |
Return the elements of an array that satisfy some condition. |
Counting
method |
description |
count_nonzero(a[, axis]) |
Counts the number of non-zero values in the array a. |