我将自纪元以来的第二个采购日期作为浮点数(来自 time.time() )并且我试图将其绘制成这样转换它(行 [0]):
x,y = [],[]
csv_reader = csv.reader(open(csvFile))
for line in csv_reader:
x.append(float(line[1]))
y.append(time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(float(line[0]))))
fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot(x,y,'o-')
fig.autofmt_xdate()
plt.show()
但 matplotlib 不断出错,如下所示:
ValueError:float() 的无效文字:2013-07-08 15:04:50
关于如何正确格式化的任何想法?
干杯