I am trying to extract the numerical month from the DataFrames index column (these are currently in my DateTime objects).
The step before I Used the resample function followed by the sum function to calculate the total usage for each month. Store this in a variable called monthly.
Date
2012-01-31 4915
2012-02-29 6712
2012-03-31 26229
2012-04-30 67699
To extract the numerical month from the DataFrames index column ive tried
monthly['Month'] = pd.DatetimeIndex(monthly['Date']).month
but I get an error keyError:'Date'