Fill NaNs introduced in merge for proximity.

rapids
junos 2021-08-21 19:40:42 +02:00
parent a71e132edf
commit ee30c042ea
2 changed files with 11 additions and 1 deletions

View File

@ -5,7 +5,12 @@ import pandas as pd
from config.models import Participant, Proximity from config.models import Participant, Proximity
from setup import db_engine, session from setup import db_engine, session
FEATURES_PROXIMITY = ["freq_prox_near", "prop_prox_near"] FILL_NA_PROXIMITY = {
"freq_prox_near": 0,
"prop_prox_near": 1/2 # Of the form of a / (a + b).
}
FEATURES_PROXIMITY = list(FILL_NA_PROXIMITY.keys())
def get_proximity_data(usernames: Collection) -> pd.DataFrame: def get_proximity_data(usernames: Collection) -> pd.DataFrame:

View File

@ -72,6 +72,11 @@ class SensorFeatures:
self.df_features_all = safe_outer_merge_on_index( self.df_features_all = safe_outer_merge_on_index(
self.df_features_all, self.df_proximity_counts self.df_features_all, self.df_proximity_counts
) )
self.df_features_all.fillna(
value= proximity.FILL_NA_PROXIMITY,
inplace=True,
downcast="infer",
)
print("Calculated proximity features.") print("Calculated proximity features.")
if "communication" in self.data_types: if "communication" in self.data_types: