0

I need help using python and pandas. I want to find the ship nearest Lat= 45.82019 and Lon= -129.73671. Here is the imported data

import os
import pandas as pd

master_df = pd.DataFrame()

for file in os.listdir(os.getcwd()): #combine all csv file
    if file.endswith('.csv'):
        master_df = master_df.append(pd.read_csv(file))

master_df.to_csv('Combined File.CSV', index = False)

df = pd.read_csv('Combined File.CSV')
print(df)

my data output: enter image description here

After finding the ship nearest given specific lat&lon, I would like to get all info about that ship.

begin_s
  • 39
  • 3
  • Does this answer your question? [Find the closest latitude and longitude](https://stackoverflow.com/questions/41336756/find-the-closest-latitude-and-longitude) – Bashar Mar 11 '22 at 21:18
  • If you need it multiple times, and you need the search to be fast, you coudl use a https://en.wikipedia.org/wiki/K-d_tree. Here's an example in python https://github.com/Vectorized/Python-KD-Tree . Also : what did you try? – Eric Duminil Mar 11 '22 at 21:22
  • I hope that worked but mine is csv file and not integer. Idk how to do that – begin_s Mar 11 '22 at 21:39

0 Answers0