假设我有一个科学出版物的数据集、它们的国家和评估出版物质量的得分指标。有点像以下内容:
论文 | 国家 | 得分 |
---|---|---|
Pub 1 | 美国 | |
Pub 2 | 中国 | |
Pub 3 | 日本 | >td style="text-align:right;">9|
Pub 4 | 中国 | >td style="text-align:right;">4
像这样的东西怎么样
fig = px.choropleth(df[['Country', 'Score']].groupby('Country').sum().reset_index(),
locations = 'Country',
color='Score')
请参阅Plotly中的示例,其中只需要传递列名。