Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 2014-07-10 11:49:14.377102 45
- 2014-07-10 11:50:14.449150 45
- 2014-07-10 11:51:14.521168 21
- 2014-07-10 11:52:14.574241 8
- 2014-07-10 11:53:14.646137 11
- 2014-07-10 11:54:14.717688 14
- #! /usr/bin/env python
- import pandas as pd
- import matplotlib.pyplot as plt
- data = pd.read_fwf('myfile.log',header=None,names=['time','amount'],widths=[27,5])
- data.time = pd.to_datetime(data['time'], format='%Y-%m-%d %H:%M:%S.%f')
- plt.plot(data.time,data.amount)
- plt.show()
- data.time = pd.to_datetime(data['time'], format='%Y-%m-%d %H:%M:%S.%f')
- data.set_index('time') # Fails!!
- data.time.plot()
- TypeError: Empty 'Series': no numeric data to plot
- #! /usr/bin/env python
- import pandas as pd
- import matplotlib.pyplot as plt
- data = pd.read_fwf('myfile.log',header=None,names=['time','amount'],widths=[27,5])
- data.time = pd.to_datetime(data['time'], format='%Y-%m-%d %H:%M:%S.%f')
- data.set_index(['time'],inplace=True)
- data.plot()
- #OR
- plt.plot(data.index, data.amount)
Add Comment
Please, Sign In to add comment