I have a data frame which has everyday for a month, and for each day the times every 10 minutes:
Date Time Temp
0 31/05/2006 09:00 9.3
1 31/05/2006 09:10 10.1
2 31/05/2006 09:20 10.7
I am trying to get the time (hh:mm) for the Max(Temp), so I used the function argmax
for calculating the index of the Max(Temp)
maxTime = data.iloc[data[data['Date'] == '31/05/2006']['Outside Temperature'].argmax()]['Time']
That's fine, but now I need to calculate this for each day of the month, so I put this inside a loop. First I created the list MaxTempTime for saving the results of my loop:
MaxTempTime = []
for i in data['Date']:
maxTime = data.iloc[data[data['Date'] == i ]['Outside Temperature'].argmax()]['Time']
MaxTempTime.extend(maxTime)
print maxTime
But I get the answer as many times as there are per day, I just need it only once and then go on to the next date
(having periods of 10 min, there are 144 periods of 10 minutes within the 1440 minutes per day, so I get 144 of the same answer per each day)
Can anybody help me sort out this please? Thanks!