I am trying to plot multiple time series curves and setting x axis date range and interval and I got an error of ValueError: Could not convert object to NumPy timedelta. no sure why? Thanks for help
df
05A75 08A77 13A78 15A77
Date
2020-01-01 396.2 0.0 0.0 310.7
2020-01-02 390.4 0.0 3.2 332.7
2020-01-03 394.5 0.0 13.1 340.2
2020-01-04 392.9 0.0 0.0 297.4
2020-01-05 393.2 0.0 133.9 244.5
date_min=df.index[0]
date_max=df.index[-1]
date_step=np.timedelta64(30,'D')
plt.figure(figsize=(20,12))
plt.plot(df.index,df.rolling(window=30,center=True,win_type='exponential').mean(),label=df.columns)
plt.xticks(np.arange(date_min,date_max,step=date_step))
plt.legend()
plt.show()
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_21828/184957987.py in <module>
1 plt.figure(figsize=(20,12))
2 plt.plot(df.index,df.rolling(window=30,center=True,win_type='exponential').mean(),label=df.columns)
----> 3 plt.xticks(np.arange(date_min,date_max,step=date_step))
4 plt.legend()
5 plt.show()
ValueError: Could not convert object to NumPy timedelta
I am strugllting with it so decide to just use df.plot, then i got date range very strange