first of all please don't judge me but i am trying to build a folium map with markers of all the McDonalds places in my country.
the first thing i did was downloading with webscraper all the nqmes and addresses of the places
secondly i am trying to convert them with the geopy library to lat/lon points in order to load them into a folium marker
import folium
import pandas as pd
from geopy.geocoders import ArcGIS
snifim_df = pd.read_csv('Snif.csv')
nom = ArcGIS()
snifim_df['LAT'] = snifim_df['Address'].apply(nom.geocode).apply(lambda x:x.latitude)
snifim_df['LON'] = snifim_df['Address'].apply(nom.geocode).apply(lambda x:x.longitude)
my folium code will look like this
Mcmap = folium.Map(location=[35.58, -92.09], zoom_start = 6)
fg = folium.FeatureGroup(name = "McDonalds")
snif_lat = list(snifim_df['LAT'])
snif_lon = list(snifim_df['LON'])
snif_name = list(snifim_df['Name'])
for lat,lon, name in zip(snif_lat,snif_lon,snif_name):
fg.add_child(folium.Marker(location=[lat,lon],popup=name))
Mcmap.add_child(fg)
Mcmap.save("test.html")
whenever i run this code one of two errors happen:
1) i get a geopy timeout error "geopy.exc.GeocoderTimedOut: Service timed out"
2) the code runs without an error but an html map does not appear in my folder
my dataset looks like this with 169 lines:
can someone please save me and explain to me what is going wrong and how to fix it?
thanks in advance :)