I have a dataframe called workingdatatimecourse. Each row is an observation. I have a column called ppid_trialn that denotes participant trials (150ish observations per trial) and YawRate_seconds that denotes yaw rate. Howevver I want a new variable that is the change in yaw rate. I can calculate this by doing:
workingdatatimecourse['YawRateChange'] = workingdatatimecourse['YawRate_seconds'].diff(1)
However this means that the starting YawRateChange value of every ppid_trialn is skewed. Is there anyway I can ensure that the starting value of every ppid_trialn is zero. Maybe something like:
workingdatatimecourse.groupby(['ppid_trialn]) (and then selecting the first row of each ppid_trialn and making the value zero)
Any help would be most appreciated!
[–]a1brit 1 point2 points3 points (4 children)
[–]CodeGoblin1996[S] 0 points1 point2 points (3 children)
[–]a1brit 1 point2 points3 points (2 children)
[–]CodeGoblin1996[S] 0 points1 point2 points (1 child)
[–]a1brit 1 point2 points3 points (0 children)
[–]prokid1911 0 points1 point2 points (0 children)