Dash Choropleth基于频率或计数的地图颜色



假设我有一个科学出版物的数据集、它们的国家和评估出版物质量的得分指标。有点像以下内容:

>td style="text-align:right;">9>td style="text-align:right;">4
论文 国家 得分
Pub 1 美国
Pub 2 中国
Pub 3 日本
Pub 4 中国

像这样的东西怎么样

fig = px.choropleth(df[['Country', 'Score']].groupby('Country').sum().reset_index(), 
locations = 'Country',
color='Score')

请参阅Plotly中的示例,其中只需要传递列名。

最新更新