Issues with Folium Choropleth Mapping Example

半世苍凉 提交于 2019-12-06 06:23:00

I think the issue is a mis-match of column names:

1) data=state_data has columns ['State', 'Unemployment'] 2) if you open us-states.json, you will find key_on='feature.id' corresponds to '01', '02' and so on..

In folium key_on is suppose to match the first column of data, in this case 'State'.

But '01', '02' ..doesn't fit 'State' column which has 'AL', 'AK', 'AZ'..

If you could come up with key_on in us-states.json that matches 'States' columns, I think it should solve your problem.

Note: I am assuming us-states.json is from https://raw.githubusercontent.com/alignedleft/d3-book/master/chapter_12/us-states.json and US_Unemployment_Oct2012.csv from https://raw.githubusercontent.com/python-visualization/folium/master/examples/US_Unemployment_Oct2012.csv

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!