I've two dataframes which contain the following:
DF1: some data associated to some coordinates, n rows:
ID1 Lat1 Lon1
ID2 Lat2 Lon2
ID3 Lat3 Lon3
...
ID_n Lat_n Lon_n
DF2: some different data associated to another coordinates, s rows:
ID'1 Lat'1 Lon'1
ID'2 Lat'2 Lon'2
ID'3 Lat'3 Lon'3
...
ID'_s Lat'_s Lon'_s
Note that n!=s.
What I need to do is, using python/pandas, for DF1[ID1] calculate the distance between Lat1/Lon1 and ALL Lat'1...Lat's/Lon'1...Lon's and get the minimum value.
The calculus of the distance is not a problem, the problem is how i can implement the iterated loop. An example of what i need:
ID N
1 5
2 3
3 6
4 9
ID' N'
1 2
2 4
3 1
Result would be:
ID Nmin
1 1 (5-4)
2 -1 (3-4)
3 2 (6-4)
4 5 (9-4)