Jawad commited on
Commit
c2aa26d
·
1 Parent(s): 8ef9b39

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +48 -2
app.py CHANGED
@@ -1,4 +1,50 @@
1
  import streamlit as st
 
 
 
2
 
3
- x = st.slider('Select a value')
4
- st.write(x, 'squared is', x * x)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import streamlit as st
2
+ import pandas as pd
3
+ from streamlit_folium import folium_static
4
+ import folium
5
 
6
+ used_fields = ["classe_estimation_ges",
7
+ "latitude",
8
+ "longitude",
9
+ #"nom_methode_dpe",
10
+ "usr_diagnostiqueur_id",
11
+ "numero_dpe",
12
+ "secteur_activite",
13
+ "organisme_certificateur",
14
+ "adresse_organisme_certificateur",
15
+ "geo_adresse",
16
+ #"tv016_departement_id",
17
+ "tv016_departement_departement",
18
+ "commune"]
19
+
20
+
21
+ @st.cache
22
+ def load_data():
23
+ return pd.read_excel("dpe-tertiaire.xlsx")
24
+
25
+ # load data
26
+ DPE = load_data()
27
+ DPE = DPE[used_fields]
28
+
29
+ # filter departement
30
+ departe = st.sidebar.selectbox('Séléctionnez le département', DPE['tv016_departement_departement'].unique())
31
+ sub_DPE = DPE[DPE.tv016_departement_departement == departe]
32
+ commune = st.sidebar.selectbox('Séléctionnez la commune', sub_DPE['commune'].unique())
33
+ sub_DPE = DPE[DPE.commune == commune].dropna()
34
+ st.header('Département sélectionné:', departe)
35
+ st.header('Commune sélectionnée:', departe)
36
+
37
+ st.subheader("DPEs effectués")
38
+ st.dataframe(sub_DPE)
39
+
40
+ # set the map center
41
+ m = folium.Map(location=[sub_DPE.latitude.mean(), sub_DPE.longitude.mean()], zoom_start=10)
42
+ for index, row in sub_DPE.iterrows():
43
+ # add marker for Liberty Bell
44
+ tooltip = row['geo_adresse']
45
+ folium.Marker(
46
+ [row['latitude'], row['longitude']], popup=row['geo_adresse'], tooltip=tooltip
47
+ ).add_to(m)
48
+
49
+ # call to render Folium map in Streamlit
50
+ folium_static(m)