python – plotting heatmaps with kepler.gl
I have a pandas DataFrame with the following schema:
zip_name: string
zip_code_geom: string
score: double
I am attempting to plot a heatmap with score
as the scale. How do I modify the following code to produce a heatmap visualization in kepler.gl?
df['score'] = df['score'].astype('float32')
# Convert geometries to WKT format
df['geometry_wkt'] = df['zip_code_geom'].apply(lambda geom: geom.wkt)
map1 = KeplerGl(
height=600,
config={
'mapState': {'latitude': 39.8097343, 'longitude': -98.5556199, 'zoom': 3},
'title': 'scores'
},
show_docs=False
)
map1.add_data(
data=df,
name="scores"
)
# Show the map
display_kepler(map1)
The above code creates a base layer map visualization with geometries, but doesn’t plot a heatmap.
Read more here: Source link