qcut and cut function in python stack overflow
>>> x=np.array([24, 7, 2, 25, 22, 29])
>>> x
array([24, 7, 2, 25, 22, 29])
>>> pd.cut(x,3).value_counts() #Bins size has equal interval of 9
(2, 11.0] 2
(11.0, 20.0] 0
(20.0, 29.0] 4
>>> pd.qcut(x,3).value_counts() #Equal frequecy of 2 in each bins
(1.999, 17.0] 2
(17.0, 24.333] 2
(24.333, 29.0] 2