cudf.Series.digitize#

Series.digitize(bins, right=False)#

Return the indices of the bins to which each value belongs.

Parameters:
binsnp.array

1-D monotonically, increasing array with same type as this series.

rightbool

Indicates whether interval contains the right or left bin edge.

Returns:
A new Series containing the indices.

Notes

Monotonicity of bins is assumed and not checked.

Examples

>>> import cudf
>>> s = cudf.Series([0.2, 6.4, 3.0, 1.6])
>>> bins = cudf.Series([0.0, 1.0, 2.5, 4.0, 10.0])
>>> inds = s.digitize(bins)
>>> inds
0    1
1    4
2    3
3    2
dtype: int32