Save second csv-file

PsychoPy version: v 2023.2.3

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.

I checked this post: Saving trial data using csv writer - #2 by Michael but don’t understand the solution.



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)

creates a csv titled “999Info.csv”

I hope this helps!

Pandas won’t work online and I don’t think you can create additional CSV files.

Could you put this information on the Pavlovia shelf instead of into a data file?

Alternatively you might be able to use an embedded survey and delete the survey data from the csv file after it have been created.

How are you deleting the data? Just using something like thisExp.addData(‘Email’,‘’) ?


What does this mean?

The shelf is one of the tabs in your Pavlovia account. It can only be accessed by the owner and can store lists or dictionaries.

Thanks. I got it running.

Do I have to add a record myself?

or can I do it with a code-element?

psychoJS.shelf.addIntegerValue({key: [‘participant_counter’], delta: 1})

I get this error:

{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.

assuming, I have 100 values in this list. How do I download it efficiently?

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.