sanitary / app.py
analist's picture
Update app.py
3e96981 verified
raw
history blame
956 Bytes
import pandas as pd
import plotly.express as px
import json
import geopandas as gpd
import folium
import streamlit as st
# Specify the path to your GeoJSON file
geojson_file_path = 'BNDA_TGO_2017-06-29_lastupdate.geojson'
geojson_data = json.load(open(geojson_file_path, "r"))
# Read the GeoJSON file using geopandas
gdf = gpd.read_file(geojson_file_path)
gdf_merged_q = pd.read_csv('merged_q.csv')
fig = px.choropleth_mapbox(gdf_merged_q,
geojson=geojson,
locations=gdf_merged_q.index,
color='scores',
mapbox_style="carto-positron",
title="Scores de Propreté Pour Les Préfectures Du Togo",
hover_name="adm2nm",
color_continuous_scale="Viridis"
)
fig.update_layout(margin={'r':0, 't':0, "l": 0, 'r': 0})
fig.show()
st.plotly_chart(fig)