Streetlights per ward in Bengaluru
# Uncomment to install geopandas if not already installed
# !pip install geopandas
import geopandas as gpd
import pandas as pd
# Load data
lights = pd.read_csv("C:\\Users\\ADMIN\\Downloads\\streetlights-in-bengaluru-wards.csv")
world = gpd.read_file("BBMP.geojson")
# Plot the world GeoDataFrame
world.plot()
# Convert 'KGISWardName' columns to string
world['KGISWardName'] = world['KGISWardName'].astype(str)
lights['KGISWardName'] = lights['KGISWardName'].astype(str)
lights['Street lights'] = lights['Street lights'].astype(int)
# Merge the DataFrames on 'KGISWardName'
result = pd.merge(world, lights, on='KGISWardName', how='inner')
result.plot(column='Street lights', legend=True, cmap='YlOrBr')
<Axes: >