I have an experiment that is offered online via Pavlovia. Some demographic data is collected and used by several people. However, there is one piece of information that should only be accessible to one person for data protection reasons. I would like to create an additional CSV file for this single piece of information and store it there.
I already know how to delete this information from the usual CSV file, but I’m not sure how to create a separate CSV file just for this specific information using PsychoPy builder and code blocks.
Hi! You’ll want to use pandas for this - in “Before Experiment” you’ll add
import pandas as pd
The rest of this should be in a code component at the end of the experiment (such as a thank you/ending routine) in “Begin Routine”. If you haven’t already, create a variable of the sensitive info you need
info = #whatever info you’re getting from the experiment
From there, you’ll create a dataframe and export it to a csv
infoDF = pd.DataFrame(info)
infoDF.to_csv(expInfo[‘participant’]+‘Information.csv’, index = False, header = False)
{origin: ‘Shelf._updateValue’, context: ‘when updating the value of the INTEGER record associated with key: [“participant_counter”]’, error: ‘unable to find a record associated with the given key’}
I have different experiments and setting records up myself, is a high error source, if I forget it.
Either copy and paste the dictionary into some code or Excel, or give the shelf entry designer scope and write a separate PsychoPy experiment that reads it into a data file.
You could do the latter with experiment scope if you had a “password” participant that activated the download code.