1/ Original data in excel
I have a data frame with these data values as shown below:
2/ Coding
Loading this excel into a data frame, wrote a pivot_table code to index the category and display the count of transactions for each month.
This is the code:
loadexpense_df = pd.read_excel("C:ExpensesTestData.xlsx")
month_df = pd.pivot_table(loadexpense_df,index="Category",columns="Month",aggfunc={"Month":len}, fill_value=0)
The result of month_df as shown below:
3/ Question
I would want to arrange the month colunms in this order: Feb, Mar, Apr and so on. Is this possible to do?
Thanks for the guidance