Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/288.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Choropleth贴图不显示_Python_Choropleth - Fatal编程技术网

Python Choropleth贴图不显示

Python Choropleth贴图不显示,python,choropleth,Python,Choropleth,下面的代码未显示所附图像中所示的预期输出。我的代码遗漏了什么 gjson=r'https://cocl.us/sanfran_geojson' Sanfransisco=folium.Map(location=[37.77, -122.42], zoom_start=12, tiles='Mapbox Bright') Sanfransisco.choropleth( geo_data=gjson, data=df, columns=['Neighbourhood','C

下面的代码未显示所附图像中所示的预期输出。我的代码遗漏了什么

gjson=r'https://cocl.us/sanfran_geojson'
Sanfransisco=folium.Map(location=[37.77, -122.42], zoom_start=12, tiles='Mapbox Bright')
Sanfransisco.choropleth(
    geo_data=gjson,
    data=df,
    columns=['Neighbourhood','Count'],
    key_on='feature.properties.District',
    fill_color='YlOrRd', 
    fill_opacity=0.7, 
    line_opacity=0.2,
    legend_name='Crime rate in Sanfransisco'
文件“”,第11行 legend_name='Sanfransisco的犯罪率' ^
SyntaxError:解析时出现意外的EOF

函数上需要一个右括号。试试这个:

Sanfransisco.choropleth(
    geo_data=gjson,
    data=df,
    columns=['Neighbourhood','Count'],
    key_on='feature.properties.District',
    fill_color='YlOrRd', 
    fill_opacity=0.7, 
    line_opacity=0.2,
    legend_name='Crime rate in Sanfransisco')
我们无法判断您的代码是否存在任何其他问题,因为我们不知道您的数据帧的形式