my.body.sleep: fix issue with attaching temperature

seems that the index operator only works when boundaries are in the dataframe
This commit is contained in:
Dima Gerasimov 2021-07-04 21:02:23 +01:00 committed by karlicoss
parent 599a8b0dd7
commit 382f205429

View file

@ -23,8 +23,9 @@ class Combine:
if pd.isna(start) or pd.isna(end):
return None
between = (start <= temp.index) & (temp.index <= end)
# on no temp data, returns nan, ok
return temp[start: end].mean()
return temp[between].mean()
df['avg_temp'] = df.apply(calc_avg_temperature, axis=1)
return df