From 382f2054298d92077d796f6eccebf467c6f04143 Mon Sep 17 00:00:00 2001 From: Dima Gerasimov Date: Sun, 4 Jul 2021 21:02:23 +0100 Subject: [PATCH] my.body.sleep: fix issue with attaching temperature seems that the index operator only works when boundaries are in the dataframe --- my/body/sleep/common.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/my/body/sleep/common.py b/my/body/sleep/common.py index 0b6fa1c..a07b3fa 100644 --- a/my/body/sleep/common.py +++ b/my/body/sleep/common.py @@ -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