Answers for "pandas add quantile columns"

0

pandas add quantile columns

df['quantile'] = pd.qcut(df['b'], 2, labels=False)

   a    b  quantile
0  1    1         0
1  2   10         0
2  3  100         1
3  4  100         1
Posted by: Guest on September-10-2021

Python Answers by Framework

Browse Popular Code Answers by Language