I have the below dataframe test and my objective is to check if the time period repeats and if it repeats I want to group by and take a mean of repeated time rows
My desired output will be like
I have tried the below code
for i in range(len(test)-1): if test['time'][i] == test['time'][i+1]: test[i:i+1].groupby('time').mean().reset_index() else: break
But its not working as desired. Will appreciate any help. Thank you