dask 2021.10.0

ParametersReturns
argtopk(a, k, axis=-1, split_every=None)

This performs best when k is much smaller than the chunk size. All results will be returned in a single chunk along the given axis.

Parameters

x: Array :

Data being sorted

k: int :
axis: int, optional :
split_every: int >=2, optional :

See topk . The performance considerations for topk also apply here.

Returns

Selection of np.intp indices of x with size abs(k) along the given axis.

Extract the indices of the k largest elements from a on the given axis, and return them sorted from largest to smallest. If k is negative, extract the indices of the -k smallest elements instead, and return them sorted from smallest to largest.

Examples

This example is valid syntax, but we were not able to check execution
>>> import dask.array as da
... x = np.array([5, 1, 3, 6])
... d = da.from_array(x, chunks=2)
... d.argtopk(2).compute() array([3, 0])
This example is valid syntax, but we were not able to check execution
>>> d.argtopk(-2).compute()
array([1, 2])
See :

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


File: /dask/array/reductions.py#1523
type: <class 'function'>
Commit: