I recently asked a question regarding splitting a list by an nth element (Splitting a list by an nth value in python). It was a duplicate question and I was showed an answer to a similar question. While it answers to some degree, I can't separate my lists for each participant
go_separate = []
for i in range(0, len(go), 60):
go_separate.append(go[i : i+60])
When I use this code it does separate my data by each 60th element (which is what I wanted it to do) but I want each separate list to be for a participant. I have a dictionary {data} with a range(1,21) but it doesn't work properly when trying to split the list like this:
for p in range(1,21):
for i in range(0, len(go), 60):
data[p]=(go[i : i+60])
Here is a reminder of my original question:
I have a list of go and no-go trial reaction times. There is 1,200 in the go list and 1200 in the no-go list. Each 60th value in both of the separate lists are from one participant and I have 20 participants in total (60*20=1200) I need to be able to split every 60th value (e.g. 1-60= participant 1, 61-121=Participant 2) so that I can separate each participants value. I am trying to get this into a dictionary where the participant number is 1-20 and the value is the reaction time. This is the code I have (just for the go condition) so far but I can't work out how to do this:
data={}
for participant in range(1,21):
data[participant]=go[:60]
Or is there an easier way to do this (splitting participant data so that I can get reaction time for each separate participant) than this method that I'm trying? Any help would be greatly appreciated.