I have a dataframe:
Date 0:15 0:30 0:45 ... 23:15 23:30 23:45 24:00
2004-05-01 3.74618 3.58507 3.30998 ... 2.97236 2.92008 2.80101 2.6067
2004-05-02 3.09098 3.84625 3.54672 ... 2.83725 2.93876 2.82762 2.6255
How do I convert it to:
Date value
2004-05-01 0:15 3.74618
2004-05-01 0:30 3.58507
2004-05-01 0:45 3.30998
...
I wrote some code which does work, but I'm sure it's possible to do the same in more elegant couple of lines code
cols = []
for col in frame.columns.values:
if col != '24:00':
dt = self.datetime(col, '%H:%M')
td = timedelta(hours=dt.hour, minutes=dt.minute)
else: td = timedelta(days=1)
dt1 = date + td
cols.append(dt1)
frame.columns = cols
frame = frame.T
You can use: