we need to replace ``` stim_trials = trials[trials['stimulus']==stim] ``` with ``` stim_trials = trials[(trials['stimulus']==stim) & (trials['recording'] == rec)] ```