Replace NA with 0 for heart rate zone features

pull/95/head
Meng Li 2020-03-05 16:49:06 -05:00
parent f38199a2ab
commit 2ea599e262
1 changed files with 1 additions and 0 deletions

View File

@ -43,6 +43,7 @@ if not heartrate_data.empty:
for feature_name in list(set(["lengthoutofrange", "lengthfatburn", "lengthcardio", "lengthpeak"]) & set(metrics)):
heartrate_zone = heartrate_data[heartrate_data["heartrate_zone"] == feature_name[6:]]
heartrate_features["heartrate_" + day_segment + "_" + feature_name] = heartrate_zone.groupby(["local_date"])["device_id"].count() / num_rows_per_minute
heartrate_features.fillna(value={"heartrate_" + day_segment + "_" + feature_name: 0}, inplace=True)
heartrate_features = heartrate_features.reset_index()