I have two lists(or columns of dataframe - doesn't matter) of numerical values:
L1 = [1, 0.5, 3, 7, 4.7]
L2 = [2, 0.4, 8, 0.3, 5]
for example. I need to correlate these lists and find pairs(indexOfElementFromL1, indexOfElementFromL2)
which corresponds min diff of two elements. For example, for my example it should be:
(0,1), (1,1), (2,0), (3,2), (4,4).
Really what I want - find closest element L2 to each one of L1. Of course I could naive approch like:
for el1 in L1:
for el2 in L2:
....
But I'd to like to see more correct solution