I have a dataframe called allData with thousands of rows of participant data, where each row contains: a single trial's participant number (single value) and a numpy array of x,y trajectory data (always 2 columns, but ranges from 100-900 rows in length). The dataframe allData looks like this:
participantNum data
0 6432024 [[-16.0, 5.0], [-16.0, 5.0], [-15.83345, 5.0],...
1 1039607 [[-16.0, 5.0], [-16.0, 5.0], [-16.0, 5.0], [-1...
2 6950203 [[-16.0, 5.0], [-16.0, 5.0], [-16.0, 5.0], [-1...
3 8486566 [[-16.0, -5.0], [-16.0, -5.0], [-16.0, -5.0], ...
4 1315866 [[-16.0, 5.0], [-16.0, 5.0], [-16.0, 5.0], [-1...
5 8593676 [[-16.0, 5.0], [-16.0, 5.0], [-16.0, 5.0], [-1...
6 9526582 [[-16.0, 5.0], [-16.0, 5.0], [-16.0, 5.0], [-1...
7 6432024 [[-16.0, 5.0], [-16.0, 5.0], [-16.0, 5.0], [-1...
8 9719645 [[-16.0, -5.0], [-16.0, -5.0], [-16.0, -5.0], ...
9 7830381 [[-16.0, -5.0], [-16.0, -5.0], [-16.0, -5.0], ...
And if I isolate one of allData's row's x,y data with: XY = allData.iloc[1].data, it looks something like this:
[-16. , 5. ],
[-15.8315 , 5. ],
[-15.6705 , 5. ],
[-15.5039 , 5. ],
[-15.3373 , 5. ],
[-15.1691 , 5. ],
[-14.8319 , 5. ],
[-14.671 , 5. ],
[-14.5054 , 5. ],
[-14.33635 , 5. ],
[-14.1707 , 5. ],
[-13.8324 , 5. ],
[-13.66605 , 5.000121 ],
[-13.50385 , 5.000464 ],
[-13.33785 , 5.001173 ],
[-13.1701 , 5.002377 ],
[-12.83478 , 5.00674 ],
I need to iterate through all rows of the dataFrame allData and stretch the X,Y arrays so they are all 1000 rows in length (I think I need to interpolate to do this?). I want the trajectories to look the same after stretching/interpolation, just with more data points filling up the spaces.
I've tried using resampy and interp1d but I'm just struggling to figure it out.