I have the following dummy df:
data = {'count':[11, 113, 53, 416, 3835, 143, 1, 1, 1, 2, 3, 4, 3, 4, 4, 6, 7, 7, 8,8,8,9]}
df = pd.DataFrame(data)
and want to create this plot:
Namely, I want to sort the df into groups based on the frequency.
6 groups in total. Group 1-2 represents all entries in the column count that are either a 1 or 2, Group 3-4 all entries in the column count that are either a 3 or 4 and so on.
I then tried this:
new_df = pd.DataFrame(columns=['1-2', '3-4', '5-6', '7-8', '9-10', '>10'])
new_df['1-2'] = df[df['count'] > 0 & (df['count'] <= 2)].count()
Which results in 22 at the Group 1-2, so something is off here.


