Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

group by quintiles pandas

df = pd.DataFrame(np.arange(10), columns=['value'])
df['quintile'] = pd.qcut(df['value'], 5, labels=False)
df

  value quintile
1   1   0
2   2   1
3   3   1
4   4   2
5   5   2
6   6   3
7   7   3
8   8   4
9   9   4
10  10   5
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #group #quintiles #pandas
ADD COMMENT
Topic
Name
3+8 =