Skip to content

Commit

Permalink
fix REGEX default value change in pd.str.replace
Browse files Browse the repository at this point in the history
  • Loading branch information
aynazadl authored Mar 18, 2024
1 parent 50281df commit b23b2f3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions python/palin/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down Expand Up @@ -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
return prob_agreement,prob_interval1

0 comments on commit b23b2f3

Please sign in to comment.