I'm trying to workout the distance between the inner values of two consecutive items in an array.
For examples:
>>> _array=[(5, 10), (15, 20), (25, 30), (35, 40)]
>>> np_array=[np.array(x) for x in _array]
>>> distance=[x - np_array[i - 1] for i, x in enumerate(np_array)][1:]
>>> distance
[array([10, 10]), array([10, 10]), array([10, 10])]
The example above calculates the distance between the items. What I'm really after is the distance between the inner attributes of any two consecutive items in the array i.e
(15-10),(25-20),(35-30)
Desired output: [(5),(5),(5)]
Any suggestions on how to go about this? Thanks.