From b23b2f3ddcd9f32231a8947551fe2f74f155c0e4 Mon Sep 17 00:00:00 2001 From: Aynaz Adl Zarrabi <59262612+aynazadl@users.noreply.github.com> Date: Mon, 18 Mar 2024 14:39:05 +0100 Subject: [PATCH] fix REGEX default value change in pd.str.replace --- python/palin/utils/utils.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/python/palin/utils/utils.py b/python/palin/utils/utils.py index 76789d8..446c789 100644 --- a/python/palin/utils/utils.py +++ b/python/palin/utils/utils.py @@ -60,8 +60,8 @@ def compute_prob_agreement(data_df, session_identifiers=['experimentor', 'type', trial_responses_df = trial_responses_df.join(trial_responses_df[response_identifier].str.split(expand=True).rename(columns={0: '%s1' % response_identifier, 1: '%s2' % response_identifier})) #clean the response data by removing any non-numeric characters - trial_responses_df['%s1' % response_identifier] = trial_responses_df['%s1' % response_identifier].str.replace(r'\D', '') - trial_responses_df['%s2' % response_identifier] = trial_responses_df['%s2' % response_identifier].str.replace(r'\D', '') + trial_responses_df['%s1' % response_identifier] = trial_responses_df['%s1' % response_identifier].str.replace(r'\D', '', regex=True) + trial_responses_df['%s2' % response_identifier] = trial_responses_df['%s2' % response_identifier].str.replace(r'\D', '', regex=True) # drop the original response column trial_responses_df = trial_responses_df.drop(columns=[response_identifier]) @@ -133,4 +133,4 @@ def simulate_observer(internal_noise_sigma,criteria, n_trials, n_blocks=1): #probability of agreement between pass prob_agreement = np.mean(all_response_pass1==all_response_pass2) - return prob_agreement,prob_interval1 \ No newline at end of file + return prob_agreement,prob_interval1