【发布时间】:2019-09-20 05:48:20
【问题描述】:
我有一个大小合适的表格,我正在从 .csv 文件中读取它。我想创建一个值的时间图。
file = 'test.csv'
names = ['id', 'siteid', 'machineid', 'tag', 'value', 'ts', 'year', 'month', 'day', 'min', 'max', 'avg', 'std']
dataset = pandas.read_csv(file)
dataset.columns = names
dataset.head(500)
for value in dataset.ts:
datetime.datetime.strptime(value, "%b/%d/%Y %H:%M")
这是一个示例条目
id siteid machineid tag value ts year month day min max avg std
18 5758593 NaN NaN ALineFillHopper.Level.LIT_325.PV 65.410011 3/9/2019 5:30 2019 3 9 64.466148 65.627884 64.823166 0.352118
我认为这是一个错误
ValueError: time data '3/9/2019 4:00' does not match format '%b/%d/%Y %H:%M'
我在这里错过了什么?
【问题讨论】:
-
使用:
'%m%d/%Y %H:%M' -
嗯,是的。现在我正在努力遍历时间戳并绘制值。
标签: python-3.x pandas matplotlib data-science