I am searching for solution for this question for few days but unfortunately no success.
I have continuous values in a column like this:
Val: 1, 15, 2, 91, 52, 126
I need to convert these numbers into categories as intervals. For example, the first number should lie in category (1-10)
I know we can define interval and convert the data using pd.cut
pd.cut(df.val, right=False)
but my problem is that I can't define interval as I have millions of value.
The ideal solution would be that I can define the range of interval and then it automatically search the values and convert it in that category.
This would be my ideal output:
Val Val_Cat
1 1-10
15 10-20
2 1-10
91 90-100
52 50-60
126 120-130