'DataFrame.Plot display nothing

I have the following dataframe :

NaT 2019-01-01  2020-01-01  2021-01-01  2022-01-01  2023-01-01  2024-01-01
S1         -78        -145        -336         -18        -156       -114
S2          91          74         177          93         224        383
S3          12         -70        -158         -94          68        269

My Dataframe Header is made as follow :

new_header = IndexTable.iloc[3,2:9]
new_header = pd.to_datetime(new_header, errors='coerce')
DF = DF[1:]

DF.columns = new_header

Trying to plot this dataframe doing :

DF = DF.set_index('NaT')
DF.loc['S1'].plot(kind="bar", color='red')
DF.loc['S2'].plot(kind="bar")
DF.loc['S3'].plot(kind="line")
plt.axhline(y=0.5, color='black', linestyle='--')

Displays :

enter image description here

Instead of :

enter image description here

Does anyone knows what my mistake is ?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source