Plotly choropleth贴图仅打印数据帧的最后一个元素

2024-06-09 00:26:12 发布

您现在位置:Python中文网/ 问答频道 /正文

我使用Plotly express choropleth将一些数据绘制到地图中,但它仅为输入数据帧的最后一个元素绘制边界线。如果正确地给出了一行,它会为每个区域绘制一条边界线。这是一个输入数据帧, [1] :https://i.stack.imgur.com/22fz7.png 这是给出的输出, [2] :https://i.stack.imgur.com/VAH8u.png 这是我使用的代码块,
fig = px.choropleth(grand_summery,geojson=geo_data,color='total_cases', locations='district',featureidkey='properties.ADM2_EN') fig.update_geos(fitbounds='locations', visible=False) fig.show()

我从这个repo-https://github.com/MalakaGu/Sri-lanka-maps/blob/master/discrict_map/District_geo.json获得的geojson文件

数据帧作为csv文件-https://github.com/ashen007/SL_COVID_analysis/blob/master/data/exp_df.csv


Tags: 数据httpsgithubcomdatapngstackgeojson