latitudes=[]
longitudes=[]
addresses = final_data['Address'].tolist()
for address in addresses:
location = geolocator.geocode(address)
print(type(location)) #the location type is none
latitudes.append(location.latitude)
longitudes.append(location.longitude)
#Output : class 'NoneType'>
#at line 7:AttributeError: 'NoneType' object has no attribute 'latitude'
I am trying to get the coordinates of various locations which were stored in a column "Address" in the data frame. I am getting the location for single location but while iterating a loop, i am unable to go forward.
from geopy.geocoders import Nominatim
geolocator = Nominatim(user_agent="dfb568960cd8fda99a9cec76f8b97191")
location = geolocator.geocode("Andhra Pradesh, India")
print(type(location))
# Output : <class 'geopy.location.Location'>