sanitary / app.py
analist's picture
Update app.py
6b93bb5 verified
raw
history blame
975 Bytes
import pandas as pd
import plotly.express as px
import json
import geopandas as gpd
import folium
import streamlit as st
st.title('Carte')
# 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)