Note

Pandas (11) 본문

Pandas

Pandas (11)

알 수 없는 사용자 2022. 7. 31. 17:14
728x90

How to bin a numeric series to 10 groups of equal size?

# Input
ser = pd.Series(np.random.random(20))
print(ser.head())

# Solution
pd.qcut(ser, q=[0, .10, .20, .3, .4, .5, .6, .7, .8, .9, 1], 
        labels=['1st', '2nd', '3rd', '4th', '5th', '6th', '7th', '8th', '9th', '10th']).head()

'Pandas' 카테고리의 다른 글

Pandas (13)  (0) 2022.08.03
Pandas (12)  (0) 2022.08.02
Pandas (10)  (0) 2022.07.30
Pandas (9)  (0) 2022.07.29
Pandas (8)  (0) 2022.07.28
Comments