My Data is just a simple csv with a Zip Code column with an Uninsured Column to represent the percentage of uninsured population in that zip code. Also the geojson file for the zip codes is attached here
My Code is as follows:
import folium
import pandas as pd
import numpy as np
import os
import geopandas as gpd
geo_data_file=os.path.join('Zipcodes_Arc.geojson')
#load GeoJSON
with open(geo_data_file, 'r') as jsonFile:
geo_df=gpd.read_file(jsonFile)
tmp=geo_df
df=pd.read_csv(os.path.join('zip_uninsured.csv'))
#remove ZIP codes not in geo data
tmp.info()
print(tmp.CODE)
geoJSON_zips=list(tmp.CODE.unique())
df_zips=list(df.zipcode)
missing_zips = np.setdiff1d(geoJSON_zips,df_zips)
tmp = tmp.rename(columns = {"CODE":"zipcode"})
my_map = folium.Map(location=[39.95228, -75.16245], zoom_start=9,
detect_retina=True, control_scale=False)
folium.Choropleth(
geo_data=geo_df,
name='choropleth',
data=df,
columns=[ 'Uninsured','zipcode'],
key_on='zipcode',
fill_color='OrRd',
fill_opacity=0.2,
line_opacity=0.8,
line_color='Blue',
legend_name='Uninsured'
).add_to(my_map)
The zip code outlines are correctly drawn on folium map in blue outline, but the choropleth values are not (colors not filled in the zip outlines.
Am especially new to geospatial side of python and Would be obliged for any help in resolving this issue.
(This issue doesn't seem to be the same as folium blank choropleth map on jupyter, possible JSON format issue)
