I have two DataFrames (df1
, df2
) with differing sizes, but the same overall columns. Both have time stamps and latitude and longitude points. The time stamps and coordinates are the same for many points because of the frequency at which the data was collected. Here is an example of the DataFrame:
time_local | Lat | Long |
---|---|---|
2021-09-08 12:56:32-04:00 | 37.1455 | -85.0555 |
2021-09-08 12:56:32-04:00 | 37.1455 | -85.0555 |
2021-09-08 12:56:32-04:00 | 37.1455 | -85.0555 |
......................... | ....... | ........ |
The second DataFrame is the same; however, there are differences in some of the coordinate points throughout. I want to select the points in the first dataframe (df1
) closest to the points in the second dataframe (df2
); for example, if I had the following coordinate base points of (37.1455, -85.0555)
and then (37.1454, -85.0555), (37.1454, -85.0556), (37.1453, -85.0556)
then the closest point selected would be (37.1455, -85.0555)
.
Is there a function within Python that can do this easily enough?