Shuffle one column in conditions file, and shuffle two columns together

Hi there!

I am trying to create an experiment for my research project and would really appreciate some help! Please be aware I’m not the most knowledgeable on python but I’m trying to learn some :))

What I’m stuck on:

  • I need to shuffle one column for each participant, as well as shuffling two other columns (but keeping these two paired) - this shuffled file can then be used for the whole experiment
  • I would like to shuffle column 1 (Stimulus) individually, and shuffle columns 3 & 5 together (Corroutcome & Upvaluationoutcome)
  • I would like to do this so that the correct response to the Stimulus is not the same for every participant, and that the outcome is not always caused by the same response (but the fruit needs to be the same in both Corroutcome and Upvaluationoutcome, hence they need to be shuffled together)

This is the conditions file I am currently using:

Any help would be really appreciated as I have tried looking online quite a lot and can’t find a solution! Please let me know if anything needs to be clarified :))


Have a look at my independent randomisation online demo. The principle would be to preload Stimulus into a list and then use values from that list instead of the spreadsheet during the trials loop.

Hi @wakecarter

Thanks for your response!

The problem is that the correct answer for each stimulus needs to be the same throughout the experiment (e.g., one individual must always respond with ‘a’ to apple in order to get an outcome, another must always respond with ‘b’).

Would this solution you have offered allow the correct answer to remain the same for the whole experiment, or would it use a random row from the conditions file every time it chooses a value from the stimuli list?

The same needs to happen with the outcomes - if an individual gets a cherry as an outcome when they provide the correct response to an apple, they must always get a cherry when responding correctly to the apple.

I may be overcomplicating this but it would be helpful to know your thoughts.

Thanks again,

You can have a list of lists, e.g. conditions = [[‘stimuli/apples.png’,‘a’, ‘b’],[‘stimuli/grapes.png’,‘b’, ‘a’]]

Then corrans might be conditions[trials.thisN][1] and the file is conditions[trials.thisN][0]