[英]Recursion Error(Jupyter Notebook/Google Colab)
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"
“RecursionError:比较超过最大递归深度”
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)
Anyone know how to fix this error?有谁知道如何解决这个错误?
edit: 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
Import sys and set the maximum recursion depth to something higher.导入 sys 并将最大递归深度设置为更高的值。
import sys
sys.setrecursionlimit(1500) # for example 1500
However there doesn't seem to be any recursion in your code.但是,您的代码中似乎没有任何递归。 So I'm wondering how you got the error.
所以我想知道你是怎么得到这个错误的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.