I have a csv file that contains the following data.
created_at hr bp_dias bp_sys weight
18/05/2015 12:00:05 57
18/05/2015 12:00:05 79
18/05/2015 12:00:05 62
18/05/2015 12:00:05 83
I'd like to get them all into one single line, like so
created_at hr bp_dias bp_sys weight
18/05/2015 12:00:05 57 79 62 83
I tried using pandas groupby and tried grouping them according to the time stamp, but that didn't give me the result I wanted.
Here is the code I used.
df = pd.read_csv('test.csv',parse_dates=True)
df['created_at'] = pd.to_datetime(df['created_at'],unit='s')
df = df.set_index('created_at')
df = df.groupby([df.index.year,df.index.month,df.index.day])
print df.head()
df = pd.read_csv('test.csv',parse_dates=[0])you shouldn't need the other lines of code