首页 > 解决方案 > Plotly-Geo Chloropleth 不适用于 Anaconda

问题描述

所以我试图在加利福尼亚州的县上绘制一些东西,我正在使用下面的代码。不知何故,它抛出一个错误说:

Run the following commands to install the correct versions of the following modules:


    $ pip install geopandas==0.3.0
    $ pip install pyshp==1.2.10
    $ pip install shapely==1.6.3

    If you are using Windows, follow this post to properly install geopandas and dependencies:http://geoffboeing.com/2014/09/using-geopandas-windows/

    If you are using Anaconda, do not use PIP to install the packages above. Instead use conda to install them:


    $ conda install plotly
    $ conda install geopandas

由于我使用的是 Anaconda,因此我下载了 conda,并分别为 pyshp 和 shapely 安装了 pip。因此,我所有的进口产品都运行良好。我不知道为什么我仍然收到此错误。早些时候,我在 Anaconda 上处于不同的环境中,但现在我在基本环境中工作。我所有的图书馆似乎都在 lpace 但我仍然收到这个错误。

我的代码:

import geopandas
import shapely
from plotly.figure_factory._county_choropleth import create_choropleth
import plotly

counties = cal_fips['countyFIPS'].tolist()
numbers = cal_fips[cal_fips['variable'] == '4/18/20']['value'].tolist()

endpt = np.linspace(0,15000,num=30)

fig = create_choropleth(fips=counties, values=numbers, colorscale=px.colors.sequential.Reds, show_state_data=True, binning_endpoints=endpt, county_outline={'color': 'rgb(255,255,255)', 'width': 0.5}, legend_title='% change', title='% Change in disease between 1980-2014')

fig.layout.template = None
fig.show()

标签: pythonanacondaplotlydata-visualizationgeopandas

解决方案


推荐阅读