Apply changes to string answers to make them language-generic.

imputation_and_cleaning
Primoz 2022-11-11 09:15:12 +00:00
parent 6ebe83e47e
commit 74b454b07b
1 changed files with 2 additions and 2 deletions

View File

@ -84,7 +84,7 @@ def extract_ers(esm_df, device_id):
.join(se_intensity, on=['device_id', 'esm_session'], how='inner') .join(se_intensity, on=['device_id', 'esm_session'], how='inner')
# Filter sessions that are not useful # Filter sessions that are not useful
extracted_ers = extracted_ers[(extracted_ers.se_time != "0 - Ne spomnim se") & (extracted_ers.se_duration != "0 - Ne spomnim se")] extracted_ers = extracted_ers[(~extracted_ers.se_time.str.startswith("0 - ")) & (~extracted_ers.se_duration.str.startswith("0 - "))]
# Transform data into its final form, ready for the extraction # Transform data into its final form, ready for the extraction
extracted_ers.reset_index(inplace=True) extracted_ers.reset_index(inplace=True)
@ -95,7 +95,7 @@ def extract_ers(esm_df, device_id):
extracted_ers['se_duration'] = \ extracted_ers['se_duration'] = \
np.where( np.where(
extracted_ers['se_duration'] == "1 - Še vedno traja", extracted_ers['se_duration'].str.startswith("1 - "),
extracted_ers['session_end_timestamp'] - extracted_ers['event_timestamp'], extracted_ers['session_end_timestamp'] - extracted_ers['event_timestamp'],
extracted_ers['se_duration'] extracted_ers['se_duration']
) )