df4 is a dataframe with Date as index and columns with load, temp , hum and windspeed.
Date Load Temp
1 100 1.1
1 200 1.2
1 300 2.4
2 400 1.7
2 500 4.3
3 600 2.2
What I wanted to do was using a loop for to apply my function to each columns within the group and create new transposed dataframes using the KEY basically the name of my columns.
grouped = df4.groupby('Date')
cols = {'load','Temp','Windspeed','Hum'}
df_dict = {}
for col in cols:
df_dict[col] = grouped[col].apply(lambda x: x.reset_index().T)
Anyways, I have learnt two things during that painful experience - For loops use KEY and the use of dictionary...work in progress