I am using geopy with nominatim to get cities names from geographic coordinates. I am using the below code :
for index,row in data.iterrows():
georeverse = geolocator.reverse
locationdep = georeverse(row[3],language='fr-FR',exactly_one=True)
address = location.raw['address']
state=address.get('state','')
town=address.get('town','')
My problem is that it throws a time out error after treating 256 rows and my data frame contain over 100 000 rows. So how would I handle this to avoid the timeout error?
geopy.geocoders.Nominatiminstance? – Marcelo Villa May 04 '20 at 16:27from geopy.geocoders import Nominatimgeolocator = Nominatim(user_agent="class-app")@MarceloVilla-Piñeros – Nour elhouda Khettache May 04 '20 at 18:03Nominatim(user_agent="class-app", timeout=10). Furthermore, you could add atry/exceptclause to skip the rows where a time out happens. – Marcelo Villa May 04 '20 at 18:45