Jan-24-2018, 10:49 PM
(This post was last modified: Jan-24-2018, 10:49 PM by StrybolData.)
I used the following code to format my series into timestamps, but I would like to now visualise it with pyplot. I based the format on the python datetime object, so to plot time with matplotlib I converted my column into a python datetime and then to the pyplot format...
Datetime format
Next step pyplot format
Could somebody explain me what is wrong with my code?
Datetime format
spreads['Created at'] = pd.to_datetime(timedata).apply(lambda x:x.strftime('%H:%M:%S'))outcome : 07:20:00
Next step pyplot format
> import matplotlib.pyplot as plt import random x = matplotlib.dates.date2num(spreads['Created at']) y = y = [i+random.gauss(0,1) for i,_ in enumerate(x)] plt.plot(x,y)AttributeError: 'str' object has no attribute 'toordinal'
Could somebody explain me what is wrong with my code?