我有一个要绘制的熊猫数据框
obs=pd.read_csv(obsfiles[0], skiprows=1)
obs.columns = ['date', 'time', 'gw', 'temp', 'volts', 'pulses']
obs['date'] = pd.to_datetime(obs['date'])
obs=obs[(obs['date'] >= '2016-01-01')]
obs = obs.set_index('date')
obs['gw'].plot()
为什么从5月5日开始绘制数据?我没有07之前的数据。我不确定出了什么问题...
In [7]: obs
Out[7]:
time gw temp volts pulses
date
2016-07-09 05:32:23 262.41 20.87 17.52 0
2016-07-09 17:32:23 241.59 20.90 17.84 0
2016-08-09 05:32:23 254.45 20.84 17.33 0
2016-08-09 17:32:23 230.87 20.90 17.68 0
2016-09-09 05:32:23 251.39 20.80 17.22 0
2016-09-09 17:32:23 224.44 20.90 17.62 0
2016-10-09 05:32:23 252.92 20.77 17.12 0
2016-10-09 17:32:23 242.81 20.84 17.27 0
2016-11-09 05:32:23 254.76 20.77 16.92 0
2016-11-09 17:32:23 228.42 20.87 17.42 0
2016-12-09 05:32:23 252.61 20.77 16.97 0
2016-12-09 17:32:23 233.63 20.84 17.29 0
2016-09-13 05:32:23 256.29 20.77 16.83 0
2016-09-13 17:32:23 235.16 20.84 17.21 0
2016-09-14 05:32:23 257.82 20.74 16.78 0
2016-09-14 17:32:23 240.67 20.80 17.08 0
2016-09-15 05:32:23 260.57 20.70 16.65 0
2016-09-15 17:32:23 236.38 20.80 17.10 0
2016-09-16 05:32:23 259.66 20.70 16.64 0
2016-09-16 17:32:23 234.55 20.80 17.07 0
谢谢!
In [16]: obs=pd.read_csv(obsfiles[0], skiprows=1)
...: obs.columns = ['date', 'time', 'gw', 'temp', 'volts', 'pulses']
...: #obs['date']=parse_date_time(obs['date'])
...: obs['date'] = pd.to_datetime(obs['date'])
...: obs=obs[(obs['date'] >= '2016-01-01')]
...: obs = obs.set_index('date')
...: obs.sort_index()
Out[16]:
time gw temp volts pulses
date
2016-01-10 05:32:23 265.78 20.60 15.93 0
2016-01-10 17:32:23 238.53 20.67 16.28 0
2016-01-11 05:32:23 257.21 19.90 11.45 0
2016-01-11 17:32:23 234.55 20.13 12.91 0
2016-01-12 17:32:23 226.89 19.20 6.72 0
2016-01-12 05:32:23 237.00 18.93 0.15 0
2016-02-10 05:32:23 263.33 20.60 15.90 0
2016-02-10 17:32:23 241.59 20.67 16.21 0
2016-02-11 05:32:23 259.04 19.87 11.23 0
2016-02-11 17:32:23 235.16 20.10 12.78 0
2016-02-12 05:32:23 251.08 16.82 0.37 0
2016-02-12 17:32:23 229.04 19.06 6.05 0