I am trying to use the CategoricalDtype for a column by the name 'calendar month' to order the values in it from January through December. It is however NOT outputting the correct results. Not sure what I am doing wrong. Can someone please help?
Call outs:
I have two Categorical Objects in my code.
Categorical Object 1: calendar_year_sorted. This object works perfectly and is executed before the second categorical object. Partial code for this object is below and works perfectly: calendar_year_sorted = CategoricalDtype(['2020', '2021', '2022', '2023'], ordered=True)
Categorical Object 2: calendar_month_sorted. This is the object which is not working and is executed after the first object. Complete code for this object is below.
Checking Initial Values
Using Categorical Object
qa
I was hoping that the output will NOT make all the values except the month of September as 0.