-1
I’m converting a set of dates and trying to plot a chart with the converted values but I’m having the error following, someone knows what can be?
dates = data['data']
date_format = [pd.to_datetime(d) for d in dates]
rolling_average_days = 7
data['nuovi_positivi_moving'] = data['nuovi_positivi'].rolling(window=rolling_average_days).mean()
variable = 'nuovi_positivi_moving'
fig, ax = plt.subplots(figsize=(12, 5))
ax.grid()
ax.scatter(date_format,data[variable])
ax.set(xlabel="Date",ylabel=variable,title='NOVOS CASOS POSITIVOS')
date_form = DateFormatter("%d-%m")
ax.xaxis.set_major_formatter(date_form)
ax.xaxis.set_major_locator(mdates.DayLocator(interval = 3))
fig.savefig(variable + '.png')
plt.show()
and the error that returns is as follows
Typeerror: float() argument must be a string or a number, not 'Timestamp'