sanitary / app.py
analist's picture
Update app.py
20df1de verified
raw
history blame
1.05 kB
import pandas as pd
import plotly.express as px
import json
import geopandas as gpd
import folium
import streamlit as st
st.set_page_config(layout="wide")
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')
geojson = gdf_merged_q.__geo_interface__
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)