Skip to content

Instantly share code, notes, and snippets.

@abelsonlive abelsonlive/input.csv
Last active Aug 29, 2015

Embed
What would you like to do?
1 50 Diamond St. Brooklyn NY
2 442 George Road, New York, NY
"""MR-based geocoder
"""
from mrjob.job import MRJob
class MRGeocode(MRJob):
def mapper(self, _, line):
id, address = line.split(',')
lat, long = geocode(address)
line += ",{},{}".format(lat, long)
yield id, line
if __name__ == '__main__':
MRGeocode.run()
# locally
python mrgeo.py input.csv > geocoded.csv
# on EMR
python mrgeo.py input.csv -r emr > geocoded.csv
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.