This is just a repost from yesterday but I have new details to add. Take a look:
I'm creating a map that contains points that features a description of the location. I get a Recursion Error when I try to run my code. "RecursionError: maximum recursion depth exceeded in comparison"
Here is my code:
for i in range(10):
lat = map_data['LATLNG'].iloc[i][0]
long = map_data['LATLNG'].iloc[i][1]
location=map_data['address'].iloc[i]
if map_data['ValueCount'].iloc[i] > 150:
color = 'red'
elif map_data['ValueCount'].iloc[i] >= 100:
color = 'orange'
elif map_data['ValueCount'].iloc[i] < 100:
color = 'blue'
popup_text = """
Location: {}<br>
Peace Disruptions : {}<br>"""
popup_text = popup_text.format(
location,
map_data['ValueCount'].iloc[i]
)
folium.Marker( location = [lat, long], popup= popup_text,icon = folium.Icon(color= color).add_to(stl_crime_street)
Here was the traceback call:
RecursionError Traceback (most recent call last)
<ipython-input-37-e1777bcd5945> in <module>()
17 map_data['ValueCount'].iloc[i]
18 )
---> 19 folium.Marker(location = [lat, long], popup= popup_text,icon=folium.Icon(color= color)).add_to(stl_crime_street)
69 for i in container:
70 if _is_sized_iterable(i):
---> 71 for j in _flatten(i):
72 yield j
73 else:
RecursionError: maximum recursion depth exceeded in comparison
I don't know if the reason for this is because of my map_data code which is
#count the incident frenquency to each location
unique_locations = df['LATLNG'].value_counts()
PB_index = pd.DataFrame({"LATLNG" : unique_locations.index, "ValueCount":unique_locations})
PB_index.index = range(len(unique_locations))
#map_data=pd.concat([new_df['address'],PB_index], axis=1, join='inner')
map_data=pd.concat([df[['address']],PB_index], axis=1, join='inner')
map_data_head=map_data[:10]
map_data.head()
and no, this doesn't work
import sys
sys.setrecursionlimit(1500) # for example 1500
