Answer the question
In order to leave comments, you need to log in
Geopy doesn't find an address based on a string that it provided based on latitude and longitude. Why?
def get_place(name, lat, long):
geolocator = Nominatim(user_agent='rir7m')
# for index, row in norm_df.iterrows():
coord = "{}, {}".format(lat, long)
location = geolocator.reverse(coord)
try:
addr_location = geolocator.geocode(location.address)
return addr_location.raw[name]
except Exception as e:
print(location.raw)
print(e)
#location.raw['class']
norm_df['TypePlace'] = norm_df.apply(lambda x: get_place('type', x['Широта'], x['Долгота']), axis=1)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question