I’m sure there’s a fairly simple solution to this but I can’t figure it out!
My experiment has 2 loops, which I want to save as separate csvs (practice and experimental trials). I’m using a touchscreen with the participant selecting an image. In the individual participant files it records “correct” and “rt” fine using the code below:
for stimulus in [R, L]: if stimulus.contains(TrialResp): if stimulus.image == CorrectAnswer: experimentaltrials.addData('correct', 1) experimentaltrials.addData("RT", t) continueRoutine = False else: experimentaltrials.addData('correct', 0) experimentaltrials.addData("RT", t) continueRoutine = False
However using saveasWideText in the final routine of the experiment
experimentaltrials.saveAsWideText("Results_Small", delim=',', matrixOnly=False, appendFile=True)
produces the appropriately named excel file, but empty, and the following error message:
File “C:\Program Files (x86)\PsychoPy3_PY2\lib\site-packages\pandas\core\indexes\base.py”, line 2687, in get_indexer
raise InvalidIndexError(‘Reindexing only valid with uniquely’
pandas.core.indexes.base.InvalidIndexError: Reindexing only valid with uniquely valued Index objects
From googling, I understand that this is because it thinks I’m creating 2 columns called “correct”, whereas I only want one with the appropriate 0/1 added for each trial, as it shows in the individual data files.
ETA: previously I had the entire experiment on saveaswidetext and did not encounter this problem, its only now im trying to save the loops separately that I’m having this error
Any advice would be much appreciated, TIA