Here is my Series
Date
April 389
August 406
December 350
February 361
January 333
July 389
June 400
March 383
May 417
November 372
October 383
September 406
Name: Data_Value, dtype: int64
I want to sort this so the index becomes January, Fenruary, March.... I tried this code:
df.index=pd.to_datetime(df.index, errors='coerce')
df = df.sort_index()
I got this output:
Date
NaT 389
NaT 406
NaT 350
NaT 361
NaT 333
NaT 389
NaT 400
NaT 383
NaT 417
NaT 372
NaT 383
NaT 406
Name: Data_Value, dtype: int64
How can I fix it?