I've used group by and pivot table from pandas package in order to create the following table:
Input:
q4 = q1[['category','Month']].groupby(['category','Month']).Month.agg({'Count':'count'}).reset_index()
q4 = pd.DataFrame(q4.pivot(index='category',columns='Month').reset_index())
then the output :
category                            Count
Month                       6       7       8
0   adult-classes           29.0    109.0   162.0
1   air-pollution           27.0    43.0    13.0
2   babies-and-toddlers     4.0     51.0    2.0
3   bicycle                 210.0   96.0    23.0
4   building                NaN     17.0    NaN
5   buildings-maintenance   23.0    12.0    NaN
6   catering                1351.0  4881.0  1040.0
7   childcare               9.0     NaN     NaN
8   city-planning           105.0   81.0    23.0
9   city-services           2461.0  2130.0  1204.0
10  city-taxes              1.0     4.0     42.0
I'm trying to add a condition to the months, the problem I'm having is that after pivoting I can't access the columns
how can I show only the rows where 6<7<8?
 
    