I have a dataframe that looks like this:
df
Daily Risk Score
0 13.0
1 10.0
2 25.0
3 7.0
4 18.0
... ...
672 14.0
673 9.0
674 15.0
675 6.0
676 13.0
I want to count the number of times a value of 0<x<9, 9<x<17 and >=17 occurs. I tried doing this:
df1=pd.cut(df['Daily Risk Score'], bins=[0, 9, 17, np.inf], labels=['Green','Orange','Red'])
However, all this does is change the value to the label. What I want is a new dataframe that just has the counts of the values like this:
df1
Green Orange Red
x y z
What am I missing to accomplish this task?