This error is generated:
ValueError: time data '11/1/13' does not match format '%m/%d/%Y'
An example of my data. (Format- Month,Day,Year-value)
12/27/13,311
12/28/13,283
12/29/13,285
12/30/13,285
12/31/13,252
1/1/14,245
1/2/14,245
1/3/14,245
1/4/14,245
1/5/14,246
The code I have, collected on another SOF post.
import csv
import datetime as dt
import matplotlib.pyplot as plt
arch = 'test.csv'
data = csv.reader(open(arch))
data = [(dt.datetime.strptime(item, "%m/%d/%Y"), float(value)) for item, value in data]
data.sort()
[x, y] = zip(*data)
fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot(x, y)
ax.grid(True)
fig.autofmt_xdate()
plt.show()
Why is my date format throwing an error?