pandas cut() code example
Example 1: pd.cut in pandas
>>> pd.qcut(range(5), 4, labels=False)
array([0, 0, 1, 2, 3])
Example 2: pd.cut in pandas
>>> pd.qcut(range(5), 3, labels=["good", "medium", "bad"])
...
[good, good, medium, bad, bad]
Categories (3, object): [good < medium < bad]