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:
parent
599a8b0dd7
commit
382f205429
1 changed files with 2 additions and 1 deletions
|
@ -23,8 +23,9 @@ class Combine:
|
||||||
if pd.isna(start) or pd.isna(end):
|
if pd.isna(start) or pd.isna(end):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
between = (start <= temp.index) & (temp.index <= end)
|
||||||
# on no temp data, returns nan, ok
|
# 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)
|
df['avg_temp'] = df.apply(calc_avg_temperature, axis=1)
|
||||||
return df
|
return df
|
||||||
|
|
Loading…
Add table
Reference in a new issue