How can I amend your mapbox dict script to work with my geopandas dataframe (or exported GeoJson File) ?
I’m using your https://plot.ly/python/county-level-choropleth/ example.
Be great if I could simply make lists out of the columns in the geopandas dataframe…
colors = list(gpd.colors)
Can you help me amend the below script…or nudge me in the right direction?
Here are the first couple of lines of my GeoJson which I exported from GeoPandas
{
"type": "FeatureCollection",
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:EPSG::4269" } },
"features": [
{ "type": "Feature", "properties": { "STATEFP": "04", "COUNTYFP": "015", "COUNTYNS": "00025445", "AFFGEOID": "0500000US04015", "GEOID": "04015", "NAME": "Mohave", "LSAD": "06", "ALAND": 2147483647, "AWATER": 387344307, "FIPS_COMBINED": "04015", "CountyPop_2016": 205249.0, "Pop_norm": 0.02023717705973874, "Color": "#fffad7", }, "geometry": { "type": "Polygon", "coordinates":.......
How could I feed geopandas columns into your example script below?
mapbox=dict(
layers=[
dict(
sourcetype = 'geojson',
source = 'I actually did export a geojson file from geopandas if needed',
type = 'fill',
color = 'rgba(163,22,19,0.8)' #be great to make a list of the Geopandas Column -> list(gpd.color)
],
accesstoken=mapbox_access_token,
bearing=0,
center=dict(
lat=27.8,
lon=-83
),
pitch=0,
zoom=5.2,
style='light'
),
)
fig = dict(data=data, layout=layout)
py.iplot(fig, filename='county-level-choropleths-python')