I have 2 arrays of timestamps
leader = [1, 5, 15, 22]
lagger = [3, 4, 5, 6, 7, 8, 9, 10, 17]
I want to match every timestamp of the lagger with the one immediately preceding it in the leader and compute lags, obtaining the array
lags = [2, 3, 4, 1, 2, 3, 4, 5, 2]
Is there a quick manner to do with numpy/pandas?