0

Have a dataframe looks like below:

    ...     time_X_Y
0   ...  [[t11, X11,Y11]],[t12, X12, Y12],[t13, X13, Y13],...]
1   ...  [[t21, X21, Y21],[t22, X22, Y22] ,[t23, X23, Y23],...]
2   ...  [[t31, X31, Y31] ,[t32, X32, Y32],[t33, X33, Y33],...]

How to substract tii values in every row and calculate mean time difference for every row?

mean(abs(t11-t12) ,abs(t12-t13), ... ) and do this for every row

tried:

for i , sublst in enumerate(df['time_X_Y']):
    for j , value in enumerate (sublst):
        print(value[0])

which returns all of the t values in whole time_X_Y column, but don't know how to proceed.

thanks

milad
  • 11
  • 4
  • 1
    Does this answer your question? [How can I pivot a dataframe?](https://stackoverflow.com/questions/47152691/how-can-i-pivot-a-dataframe) – RoadieRich Mar 11 '22 at 20:49

0 Answers0