I have a dataframe table that has columns containing datetime information. As you can see from the table below, the 2019-xx field is between the years 2018 and 2016 so I need to arrange it properly.
I tried to use .sort_index(axis=1, inplace=True) but in vain
(I don't know why it has no effect at all).
Dataframe:
2017-12-31 2018-12-31 2019-12-31 2016-12-31 2020-06-30
Unnamed: 0
WaterFlow -26084000.0 -257404000.0 -84066000.0 135075000.0 NaN
trailing1HourWaterFlow NaN NaN -84066000.0 NaN 6823000.0
- The problem is that:
- I don't know how to arrange columns orders when it's represented as datetime info.
- The table above seems strange since that
"Unnamed: 0"row is empty and there's a space between the columns and rows unlike other ordinary dataframes.
print (df.info())?