python - 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()
解决方案
推荐阅读
- ios - Xcode 10 无法构建项目,因为无法找到 pod
- flutter - 如何修复 FBSDKLoginKit 抖动 IOS?
- javascript - Vue.js + SVG Map - 如何设置所选项目的样式?
- azure-storage - REST API 的指针,用于访问或列出 Blob 存储容器中的文件
- python-3.x - 如何修复 gitlab ci 中长时间运行的命令“python setup.py test”?
- java - 如何将部署在弹性 benstalk 上的 Web 应用程序与 aws 上的 mysql 数据库实例连接起来?
- python - 使用变换选择场景中的所有网格对象
- html - 页面完全加载后会加载一些图像
- android - 如何使字符串从日期最终格式化?
- c++ - 匹配两个数组一个用户输入和随机数?