# Shifting Data So That When Cross Correlated Lag position is 0

Using Numpy, I am cross correlating two large data sets (of different lengths), as part of a method to compare the similarity of the data. However to take the data onto the next step of the comparison I want to "align" the data such that when cross correlated the lag position is 0.

So far what I have tried is finding the lag position of the original cross correlation and then using pandas.DataFrame.shift() to shift the data such that the lag is cancelled out by the "shifting". This gives drastically different results than expected and are totally unrelated to how many indexes the data is shifted.

What I am aiming for is, after manipulation, when the data sets are cross-correlated again, the corresponding lag to be 0.

Any help would be much appreciated!