Skip to content

Instantly share code, notes, and snippets.

@cindygis
Created April 21, 2016 08:05
Show Gist options
  • Save cindygis/0ff39c0875758a9db2af1229998978db to your computer and use it in GitHub Desktop.
Save cindygis/0ff39c0875758a9db2af1229998978db to your computer and use it in GitHub Desktop.
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