Commit 8bd8c15b authored by Stefan Appelhoff's avatar Stefan Appelhoff

revert to_numpy to values method for pd.df

parent 617ec40c
......@@ -213,10 +213,10 @@ def provide_balancing_selection(df, payoff_settings):
ord(trig_dict['trig_right_choice'])]
trig_out = [ord(trig_dict['trig_show_out_l']),
ord(trig_dict['trig_show_out_r'])]
actions = df[df['value'].isin(trig_sample)]['action'].to_numpy(copy=True,
dtype=int)
outcomes = df[df['value'].isin(trig_out)]['outcome'].to_numpy(copy=True,
dtype=int)
actions = (df[df['value'].isin(trig_sample)]['action']
.copy().values.astype(int))
outcomes = (df[df['value'].isin(trig_out)]['outcome']
.copy().values.astype(int))
# combine actions and outcomes to code outcomes on the left with negative
# sign outcomes on the right with positive sign ... will end up with stim
......
......@@ -74,7 +74,7 @@ def calc_bonus_payoff(sub_id, exchange_rate=0.01, lang='en'):
trig_dict = provide_trigger_dict()
trig_fin_out = [ord(trig_dict['trig_show_final_out_l']),
ord(trig_dict['trig_show_final_out_r'])]
vals = df[df['value'].isin(trig_fin_out)]['outcome'].to_numpy()
vals = df[df['value'].isin(trig_fin_out)]['outcome'].values
points += np.sum(vals)
money = int(np.ceil(points * exchange_rate))
......@@ -174,8 +174,8 @@ def remove_error_rows(df, error_trig):
The original df with the trials containing errors remove
"""
error_idx = df.index[df['value'] == error_trig].to_numpy()
error_trls = df['trial'][error_idx].to_numpy()
error_idx = df.index[df['value'] == error_trig].values
error_trls = df['trial'][error_idx].values
remove_idx = list()
for idx, trl in zip(error_idx, error_trls):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment