简体   繁体   English

递归错误(Jupyter Notebook/Google Colab)

[英]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.

相关问题 在 Jupyter Notebook 中获取 Google Colab 自动完成功能 - Get Google Colab autocomplete in Jupyter Notebook 在 jupyter notebook 和 google colab 中使用.so - Using .so in a jupyter notebook and google colab 如何在 Google Colab 上实现这个 Jupyter Notebook? - How to implement this Jupyter notebook on Google Colab? 在 Django 应用程序中嵌入 jupyter notebook/google colab - embedding jupyter notebook/ google colab in Django app 为什么 Google Colab 会在读取 csv 时引发错误,而 jupyter notebook 不会? - Why is Google Colab raising an error for reading in a csv and jupyter notebook isn't? 如何在 google colab(python,Jupyter notebook)中安装预定义的包(类)? - How to install a predefined package(class) in google colab(python,Jupyter notebook)? 如何将 pyscipopt 导入 Google Colab(在 Jupyter Notebook 文件中)? - How to import pyscipopt to Google Colab (in the Jupyter Notebook file)? 如何真正分享上传到Google Colab的Jupyter笔记本? - How to really share a Jupyter notebook uploaded to Google Colab? 在 pip 在本地安装 google-colab 后,Jupyter 笔记本卡住了 - Jupyter notebook stuck after pip install google-colab on local 在 Google Colab 平台上的 Jupyter Notebook 中显示/渲染 HTML 文件 - Display / Render an HTML file inside Jupyter Notebook on Google Colab platform
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM