I have 'column A' contains Hotel Name, i want to write 'loc.address' for each hotel at 'column B' in excel
ex:
i use this code:
import pandas as pd
from geopy.geocoders import Nominatim
import xlrd
# Give the location of the file
loc = "C:/Users/UI UX/Desktop/test.xlsx"
# To open Workbook
wb = xlrd.open_workbook(loc)
sheet = wb.sheet_by_index(0)
sheet.cell_value(0, 0)
for i in range(sheet.nrows):
hotel_column = (sheet.cell_value(i, 0))
geolocator = Nominatim(user_agent="abd")
loc = geolocator.geocode(hotel_column, country_codes='', language='')
if loc is None:
print('Cant find latitude & longitude of this place :(')
else:
print("latitude is :", loc.latitude, "\nlongitude is:", loc.longitude)
print('Location Address: ' + loc.address)
print('---------------------------------------------------')