analist commited on
Commit
60a293b
·
verified ·
1 Parent(s): 16d5f42

Create main.py

Browse files
Files changed (1) hide show
  1. main.py +27 -0
main.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pandas as pd
2
+ import plotly.express as px
3
+ import json
4
+ import geopandas as gpd
5
+ import folium
6
+ from IPython.display import display
7
+
8
+ # Specify the path to your GeoJSON file
9
+ geojson_file_path = 'BNDA_TGO_2017-06-29_lastupdate.geojson'
10
+ geojson_data = json.load(open(geojson_file_path, "r"))
11
+ # Read the GeoJSON file using geopandas
12
+ gdf = gpd.read_file(geojson_file_path)
13
+
14
+ new_df = pd.read_csv('new_df.csv')
15
+
16
+ fig = px.choropleth(
17
+ new_df,
18
+ locations="quartier_id",
19
+ geojson=geojson_data,
20
+ color="scores",
21
+ hover_name="quartier",
22
+ hover_data=["scores"],
23
+ title="Score Sanitaire au Togo",
24
+ )
25
+ fig.update_geos(fitbounds="locations")
26
+
27
+ st.plotly_chart(fig)