# create intervals for equal-sized 5 bins
bins = np.linspace(df["price"].min(), df["price"].max(),5)
custom_labels = ["low","medium","high"]
df["price_bin"] = pd.cut(df["price"], bins, labels=custom_labels, include_lowest=True)
# Alternative approach
#perform data binning on points variable
df['points_bin'] = pd.qcut(df['points'], q=3)
#view updated DataFrame
print(df)
points assists rebounds points_bin
0 4 2 7 (3.999, 10.667]
1 4 5 7 (3.999, 10.667]
2 7 4 4 (3.999, 10.667]
3 8 7 6 (3.999, 10.667]
4 12 7 3 (10.667, 19.333]
5 13 8 8 (10.667, 19.333]
6 15 5 9 (10.667, 19.333]
7 18 4 9 (10.667, 19.333]
8 22 5 12 (19.333, 25.0]
9 23 11 11 (19.333, 25.0]
10 23 13 8 (19.333, 25.0]
11 25 8 9 (19.333, 25.0]