A few data:
date time imei battery_raw 0 2016-09-30 07:01:23 862117020146766 42208 1 2016-09-30 07:06:23 862117020146766 42213 2 2016-09-30 07:11:23 862117020146766 42151 3 2016-09-30 07:16:23 862117995146745 42263 4 2016-09-30 07:21:23 862117995146745 42293
Full Code Code:
import matplotlib.pyplot as plt fil = pd.read_csv('imei.csv', sep=r'\s*', engine='python') fig, ax = plt.subplots(figsize=(18,6)) for name, group in fil.groupby('imei'): group.plot(x=pd.to_datetime(group['time']), y='battery_raw', ax=ax, label=name) plt.show()
The x values ββmust be converted to datetime to plot, as usual. You can do this in a data frame.
Result tagged imei:
(NOTE: edited to get rid of the strangeness I was working with for the first time. If you pass the list as the y argument to group.plot , the list identifiers will be used as line labels, presumably as a convenient default value for when you draw several dependent variables at once.
#for name, group in fil.groupby('imei'):
)
source share