I'm trying to count a frequency of 2 events by the month using 2 columns from my df. What I have done so far has counted all events by the unique time which is not efficient enough as there are too many results. I wish to create a graph with the results afterwards.
I've tried adapting my code by the answers on the SO questions:
- [How to groupby time series by 10 minutes using pandas?
 - [Counting frequency of occurrence by month-year using python panda
 - [Pandas Groupby using time frequency
 
but can not seem to get the command working when I input freq='day' within the groupby command.
My code is:
print(df.groupby(['Priority', 'Create Time']).Priority.count())
which initially produced something like 170000 results in the structure of the following:
Priority  Create Time        
1.0       2011-01-01 00:00:00    1
          2011-01-01 00:01:11    1
          2011-01-01 00:02:10    1
                  ...
2.0       2011-01-01 00:01:25    1
          2011-01-01 00:01:35    1
                  ...
But now for some reason (I'm using Jupyter Notebook) it only produces:
Priority  Create Time        
1.0       2011-01-01 00:00:00    1
          2011-01-01 00:01:11    1
          2011-01-01 00:02:10    1
2.0       2011-01-01 00:01:25    1
          2011-01-01 00:01:35    1
Name: Priority, dtype: int64
No idea why the output has changed to only 5 results (maybe I unknowingly changed something).
I would like the results to be in the following format:
Priority  month     Count     
1.0       2011-01     a
          2011-02     b
          2011-03     c
                ...
2.0       2011-01     x
          2011-02     y
          2011-03     z
                ...
Top points for showing how to change the frequency correctly for other values as well, for example hour/day/month/year. With the answers please could you explain what is going on in your code as I am new and learning pandas and wish to understand the process. Thank you.