Set not NaN sum insted of 0 sum for HRV features windows.

sociality-task
Primoz 2022-07-06 07:36:35 +00:00
parent 2d5d23b615
commit d2758eef46
1 changed files with 2 additions and 1 deletions

View File

@ -1,4 +1,5 @@
import pandas as pd
import numpy as np
import math as m
import sys
@ -39,7 +40,7 @@ def extract_second_order_features(intraday_features, so_features_names, prefix="
# numWindowsNonZero specialized for BVP and IBI sensors
if "hrv_num_windows_non_nan" in so_features_names and prefix+"meanHr" in intraday_features.columns:
so_features[prefix+"SO_numWindowsNonNaN"] = intraday_features.groupby(groupby_cols)[prefix+"meanHr"].apply(lambda x: (x!=0).sum())
so_features[prefix+"SO_numWindowsNonNaN"] = intraday_features.groupby(groupby_cols)[prefix+"meanHr"].apply(lambda x: (~np.isnan(x)).sum())
so_features.reset_index(inplace=True)