I'm novice in python, and I couldn't understand how to correctly formatting dates.
My data is like this Fri, 09 Dec 2011 06:50:37 UTC
I'm preparing it like this:
dates.append(time.strptime(row[5], "%a, %d %b %Y %H:%M:%S %Z"))
Then I'm trying to use it
dates = matplotlib.dates.date2num(dates)
get following error:
AttributeError: 'time.struct_time' object has no attribute 'toordinal'
You are using the time
module, but matplotlib
expects the datetime
object.
Try using something like this:
from datetime import datetime
dates.append(datetime.strptime(row[5], "%a, %d %b %Y %H:%M:%S %Z"))
...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With