丢失数据绘图表达 px.data

问题描述

在这里的例子中

https://plotly.com/python/px-arguments/#plotly-express-works-with--long-wide-and-mixedform-data

数据导入只有一行:wide_df = px.data.medals_wide()

我通过 Anaconda 尝试了我的 Python 并得到了这个 Traceback: AttributeError: module ‘plotly.express.data’ has no attribute ‘medals_wide’

我刚刚试过这个代码

for name in dir(px.data):
    if '__' not in name:
        print(name)

并得到

absolute_import
carshare
election
election_geojson
gapminder
iris
tips
wind

根据结果我错过了一些数据,包括奖牌一个,然后我尝试在Anaconda Prompt下重新安装Plotly和Plotly Express,但问题仍然存在

Successfully installed plotly-express-0.4.1

当我尝试 pip install plotly 更新以防万一 我得到

Requirement already satisfied: plotly in c:\users\ appdata\roaming\python\python37\site-packages (4.7.1)
Requirement already satisfied: retrying>=1.3.3 in c:\users\ appdata\roaming\python\python37\site-packages (from plotly) (1.3.3)
Requirement already satisfied: six in c:\users\\anaconda3\lib\site-packages (from plotly) (1.14.0)

谢谢

解决方法

如果您更新到 Plotly 版本 4.14,它将可用。

检查您当前的版本:

import plotly
plotly.__version__

如有必要,运行:

pip install plotly==4.14.3

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...