0

I have a list with addresses in the csv file. I would like to get coordinates for this whole list. Unfortunately, I'm getting an error:

Traceback (most recent call last):

      File "<ipython-input-375-e8f87c93126d>", line 8, in <module>
        print(location.address)

    AttributeError: 'NoneType' object has no attribute 'address'

I do not know what is wrong. When I enter instead of and a specific address from my list, the loop works correctly.

from geopy.geocoders import Nominatim

for i in adres:
    geolocator = Nominatim()
    location = geolocator.geocode(i)
    time.sleep(.45)
    print(location.address)
    print((location.latitude, location.longitude))

These are the first records from my 'adres' list:

    print (adres)
['Ul. Sądowa 8  74-320 Barlinek            ', 'Ul. Armii Polskiej 36  73-260 Pełczyce            ', 'Ul. H. Sienkiewicza 5  66-500 Strzelce Krajeńskie            '
BigD
  • 77
  • 10

0 Answers0