how to make bins by pd.cut code example
Example 1: difference between cut and qcut pandas
interval_range = pd.interval_range(start=0, freq=10000, end=200000)
df['cut_ex2'] = pd.cut(df['ext price'], bins=interval_range, labels=[1,2,3])
df.head()
#There is a downside to using interval_range . You can not define custom labels.
Example 2: pd.cut in pandas
>>> pd.qcut(range(5), 4, labels=False)
array([0, 0, 1, 2, 3])