Folium Choropleth Map

hi I am quite new to python. I have been trying to make a choropleth map with folium with no success.

I am using dataset from Kaggle "U.S. College Scorecard Data 1996-2015". This is the URL for the dataset. https://www.kaggle.com/noriuk/us-college-scorecard-data-19962015/data

I want to create a choropleth map with two layers using SAT_average data and earning ten-years after graduation on a state basis.

I also have a json-dataset which has FIPS-State-Codes and state names. this is the URL for the dataset. https://gist.github.com/mshafrir/2646763

Following is the snippet of my code.

I do appreciate your help.

os.chdir(wd + '\\' + r'2646763-8b0dbb93521f5d6889502305335104218454c2bf')
state_geo = r'states_hash.json'
geo_json_data = json.load(open(state_geo))
os.chdir(wd)

m = folium.Map([43,-100], zoom_start=4)
folium.GeoJson(geo_json_data).add_to(m)
m.choropleth(geo_data=geo_json_data, data=df_SAT_earn,
          columns=['STABBR', 'SAT_AVG'],
          key_on='feature.STABBR',
          fill_color='YlGn', fill_opacity=0.7, line_opacity=0.2,
          legend_name='SAT')
folium.LayerControl().add_to(m)

m.save('test.html')

0 Comment

NO COMMENTS

LEAVE A REPLY

Captcha image