With a choropleth map, we can display a polygon GeoJSON file. Using the tracts GeoDataFrame, we'll create another GeoDataFrame with polygon geometry and one tabular field, and save it to a file as GeoJSON:
tract_poly = tractstract_poly['Male Population'] = tract_poly['ACS_15_5YR_S0101_with_ann_Male; Estimate; Total population']tract_poly = tract_poly[['Male Population','geometry' ]]tract_poly.to_file('tracts_bayarea2.geojson', driver="GeoJSON")
The visualization is created using the ChoroplethViz class. The basemap style is the URL of the satellite imagery style created earlier in the MapBox Studio, section of the chapter:
vizClor = ChoroplethViz('tracts_bayarea2.geojson', access_token=API_TOKEN, color_property='Male ...