Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to find location using latitude and longitude in python dataframe

import pandas as pd
df = pd.read_excel('your dataframe')
                   
from geopy.geocoders import Nominatim
#We will use this util to create our string tuple to further locate our longitude and latitudes
df['geom'] = df.apply(lambda row: (str(row.LAT),str(row.LONG)),axis=1)
#this prints out our newly created "geom" column
print(df.geom[0]

geolocator = Nominatim(user_agent="geoapiExercises")
df['address'] = df.apply(lambda row: geolocator.reverse(row.geom).address,axis=1)

      #AND VOILA NEWLY ADDED LOCATIONS WILL BE AT THE"address" column
Comment

PREVIOUS NEXT
Code Example
Python :: finding the format of an image in cv2 
Python :: Install Basemap on Python 
Python :: pil image base64 
Python :: creating folder in s3 bucket python 
Python :: python udp receive 
Python :: tkinter gui grid and frame 
Python :: how to find the version of python command linw 
Python :: python get dates between two dates 
Python :: replace value column by another if missing pandas 
Python :: how to open csv file in python 
Python :: use python type hint for multiple return values 
Python :: open python choose encoding 
Python :: python dictionary dot product 
Python :: join two numpy arrays 
Python :: print the number of times that the substring occurs in the given string 
Python :: install python3 6 ubuntu 20 
Python :: python import ndjson data 
Python :: Violin Plots in Seaborn 
Python :: huggingface default cache dir 
Python :: click button in selenium python 
Python :: python pandas dataframe from csv index column 
Python :: linkedin dynamic scrolling using selenium python 
Python :: pandas replace column name from a dictionary 
Python :: python code to open windows command prompt 
Python :: binary search algorithm python 
Python :: reset a turtle python 
Python :: python last element list 
Python :: python cartesian product 
Python :: pandas inner join on two columns 
Python :: how to sort dictionary in python by value 
ADD CONTENT
Topic
Content
Source link
Name
8+8 =