I'm new to python and I have hit a wall with this problem. I have a df with ID's, timestamp and lat /longs. I need to find ID's that were are near each other by location and time. I've tried groupby with pandas, but the output just lumps everything under each unique ID. Is there a way to pair or group ID's by their proximity to each ID's lat/longs (<50m) and timestamp (<=24hrs). I appreciate any help. Thanks!
ID | Timestamp | Latitude | Longitude |
---|---|---|---|
9269 | 11/23/2021 23:59 | 40.3291824 | -105.656204 |
9269 | 11/19/2021 23:59 | 40.32294108 | -105.8062935 |
9269 | 11/15/2021 23:59 | 40.13903661 | -105.5979048 |
9269 | 11/15/2021 23:39 | 40.3291824 | -105.656204 |
7359 | 11/11/2021 23:59 | 40.13903661 | -105.5979048 |
7359 | 11/7/2021 23:59 | 40.32294108 | -105.8062935 |
7359 | 11/7/2021 23:39 | 40.3291824 | -105.656204 |
2259 | 12/6/2021 0:02 | 40.32294108 | -105.8062935 |
2259 | 12/2/2021 0:02 | 40.3291824 | -105.656204 |
2259 | 11/28/2021 0:02 | 40.13903661 | -105.5979048 |