I have a list, loc_combinations, with a length of 91806 of unique ID pairs structured as so:
[(1,2), (1,3), 1,4)...(452, 454)]
I am trying to apply the same function distance_calculator to each pair in the list which returns a single value, the distance. I was able to get my answer using a for loop but was hoping someone could show me how to do it using Lambda and list comprehension.
Here is the for loop:
distance_list = []
for i in range(len(loc_combinations)):
distance_list.append(distance_calculator(id1 = loc_combinations[i][0], id2 = loc_combinations[i][1]))