I have been using polars but it seems like it lacks qcut functionality as pandas do.
I am not sure about the reason but is it possible to achieve the same effect as pandas qcut using current available polars functionalities?
The following shows an example about what I can do with pandas qcut.
import pandas as pd
data = pd.Series([11, 1, 2, 2, 3, 4, 5, 1, 2, 3, 4, 5])
pd.qcut(data, [0, 0.2, 0.4, 0.6, 0.8, 1], labels=['q1', 'q2', 'q3', 'q4', 'q5'])
The results are as follows:
0 q5
1 q1
2 q1
3 q1
4 q3
5 q4
6 q5
7 q1
8 q1
9 q3
10 q4
11 q5
dtype: category
So, I am curious how can I get the same result by using polars?
Thanks for your help.