dask 2021.10.0

NotesParametersReturnsBackRef
searchsorted(a, v, side='left', sorter=None)

This docstring was copied from numpy.searchsorted.

Some inconsistencies with the Dask version may exist.

Find the indices into a sorted array a such that, if the corresponding elements in v were inserted before the indices, the order of a would be preserved.

Assuming that a is sorted:

====== ============================ :None:None:`side` returned index i satisfies ====== ============================ left a[i-1] < v <= a[i] right a[i-1] <= v < a[i] ====== ============================

Notes

Binary search is used to find the required insertion points.

As of NumPy 1.4.0 searchsorted works with real/complex arrays containing :None:None:`nan` values. The enhanced sort order is documented in :None:None:`sort`.

This function uses the same algorithm as the builtin python bisect.bisect_left ( side='left' ) and bisect.bisect_right ( side='right' ) functions, which is also vectorized in the v argument.

Parameters

a : 1-D array_like

Input array. If :None:None:`sorter` is None, then it must be sorted in ascending order, otherwise :None:None:`sorter` must be an array of indices that sort it.

v : array_like

Values to insert into a.

side : {'left', 'right'}, optional

If 'left', the index of the first suitable location found is given. If 'right', return the last such index. If there is no suitable index, return either 0 or N (where N is the length of a).

sorter : 1-D array_like, optional

Optional array of integer indices that sort array a into ascending order. They are typically the result of argsort.

versionadded

Returns

indices : int or array of ints

Array of insertion points with the same shape as v, or an integer if v is a scalar.

Find indices where elements should be inserted to maintain order.

See Also

histogram

Produce histogram from 1-D data.

sort

Return a sorted copy of an array.

Examples

This example is valid syntax, but we were not able to check execution
>>> np.searchsorted([1,2,3,4,5], 3)  # doctest: +SKIP
2
This example is valid syntax, but we were not able to check execution
>>> np.searchsorted([1,2,3,4,5], 3, side='right')  # doctest: +SKIP
3
This example is valid syntax, but we were not able to check execution
>>> np.searchsorted([1,2,3,4,5], [-10, 10, 2, 3])  # doctest: +SKIP
array([0, 5, 1, 2])
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

dask.array.routines.searchsorted dask.array.routines.digitize

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/routines.py#763
type: <class 'function'>
Commit: