Coming soon - Get a detailed view of why an account is flagged as spam!
view details
2
Mapping coordinates for a long list of addresses?
Post Body

I am trying to use geopy.geocoders to map real estate data from Hanoi. I have a list of ~11,000 addresses of sales, I would like to assign latitude and longitude to each address so I can create a map and calculate distances relative to price, etc.

I have run this code on small batches of addresses with no issues, but when I try to scale it to the full column I am getting errors, so I tried to implement a rate limiter, but I am still getting an error after around 500 queries(I think)

What is my next step to troubleshoot this? Are there any alternative libraries or APIs I can use to assign lat/long to addresses? This is my first data viz project so I'm still pretty new to all of this.

This is the code

geolocator = Nominatim(user_agent="hanoi real estate 2020")

def get_lat_long(neighborhood):

location = geolocator.geocode(neighborhood)

return (location.latitude, location.longitude)

from geopy.extra.rate_limiter import RateLimiter

geocode = RateLimiter(geolocator.geocode, min_delay_seconds=1)

data['clean_address'] = data['clean_address'].apply(geocode)

data['clean_address'] = data['clean_address'].apply(lambda loc: tuple(loc.point) if loc else None)

data[['Latitude', 'Longitude']] = data['clean_address'].apply(get_lat_long).apply(pd.Series)

Author
Account Strength
100%
Account Age
14 years
Verified Email
Yes
Verified Flair
No
Total Karma
187,526
Link Karma
20,275
Comment Karma
164,239
Profile updated: 6 days ago
Posts updated: 4 months ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
1 year ago