Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Quickly reverse geocode coordinates in a spreadsheet
import geocoder
import pandas as pd
xls = r'C:\Some\Arb\Folder\coords.xls'
out_xls = r'C:\Some\Arb\Folder\geocoded.xls'
df = pd.read_excel(xls)
for index, row in df.iterrows():
g = geocoder.google([row[3], row[2]], method='reverse')
df.set_value(index, 'Street Address', g.address)
df.to_excel(out_xls, 'Geocoded')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.