Вот пошаговая инструкция, начиная с массива, который выложен как ваш оригинальный csv:
# 2 time points, 4 markers, values between 0 and 8
csv = np.random.randint(0,9,(2,12))
csv
# array([[8, 5, 3, 2, 3, 2, 2, 5, 6, 8, 2, 4],
# [8, 2, 7, 4, 7, 7, 8, 0, 3, 0, 2, 4]])
# reshape to get x,y,z aligned
m,n = csv.shape
xyz = csv.reshape(m,-1,3)
xyz
# array([[[8, 5, 3],
# [2, 3, 2],
# [2, 5, 6],
# [8, 2, 4]],
#
# [[8, 2, 7],
# [4, 7, 7],
# [8, 0, 3],
# [0, 2, 4]]])
# get coordinate-wise differences between adjacent markers
dist_1d = np.diff(xyz,axis=1)
dist_1d
# array([[[-6, -2, -1],
# [ 0, 2, 4],
# [ 6, -3, -2]],
#
# [[-4, 5, 0],
# [ 4, -7, -4],
# [-8, 2, 1]]])
# compute squared Euclidean distance
# (you could take the square root of that but if you are
# only interested in changes it doesn't seem necessary)
eucl2 = (dist_1d*dist_1d).sum(axis=2)
eucl2
# array([[41, 20, 49],
# [41, 81, 69]])