缺少数据 Plotly Express px.data

Missing Data Plotly Express 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