, , , # 3 4:
df = pd.io.parsers.read_csv('temp.csv', header = [0,1], tupleize_cols = True)
df.columns = [c for _, c in df.columns[:3]] + [c for c in df.columns[3:]]
df = df.set_index(list(df.columns[:3]), append = True)
df.columns = pd.MultiIndex.from_tuples(df.columns, names = ['hour', 'field'])
stack reset , .
.
(Unnamed: 0_level_0, Date) (Unnamed: 1_level_0, id) \
0 3/11/2016 5
1 3/11/2016 6
(Unnamed: 2_level_0, zone) (100, p1) (100, p2) (200, p1) (200, p2)
0 abc 0.678 0.787 0.337 0.979
1 abc 0.953 0.559 0.776 0.520
field p1 p2
Date id zone hour
0 3/11/2016 5 abc 100 0.678 0.787
200 0.337 0.979
1 3/11/2016 6 abc 100 0.953 0.559
200 0.776 0.520