I was wondering if there was some function/library that can calculate velocity in a pandas dataframe. I have the following dataframe:
Time bar_head_x bar_head_y bar_head_z
0.00 -203.3502 1554.3486 1102.8210
0.01 -203.4280 1554.3492 1103.0592
0.02 -203.4954 1554.3234 1103.2794
0.03 -203.5022 1554.2974 1103.4522
From this I want to calculate speed, velocity and acceleration. Speed and acceleration are easy: I used np.linalg.norm
to calculate the speed, like so:
speed['head'] = np.linalg.norm(speed[['bar_head_x','bar_head_y','bar_head_z']].values,axis=1)
and .diff()
to calculate acceleration from speed, like so:
acc['acc_head'] = (speed['head'].diff()) / ((speed['Time'].diff()))
But how would I go about calculating velocity in such a simple way? Is there such a way - a function to help do this?
Thanks!