pandas.cut()

pandas.cut

pandas.cut(x, bins, right=True, labels=None, retbins=False, precision=3, include_lowest=False) [source]

Return indices of half-open bins to which each value of x belongs.

Parameters:

x : array-like

Input array to be binned. It has to be 1-dimensional.

bins : int or sequence of scalars

If bins is an int, it defines the number of equal-width bins in the range of x. However, in this cas