Spaces:
Runtime error
Runtime error
Commit
·
a94f73c
1
Parent(s):
52a6b13
V2-Liste_MAP_Stat_01
Browse files- app.py +5 -7
- statistiques.py +40 -0
app.py
CHANGED
|
@@ -1,21 +1,19 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
-
import pandas as pd
|
| 3 |
-
import requests
|
| 4 |
-
import folium
|
| 5 |
-
from streamlit_folium import folium_static
|
| 6 |
-
from data_manager import get_data
|
| 7 |
from organisations_engagees import display_organisations_engagees
|
| 8 |
from localisation import display_map
|
|
|
|
| 9 |
|
| 10 |
# Main function orchestrating the app UI
|
| 11 |
def main():
|
| 12 |
st.sidebar.title("Navigation")
|
| 13 |
-
app_mode = st.sidebar.radio("Choisissez l'onglet", ["Organisations engagées", "Localisations"])
|
| 14 |
|
| 15 |
if app_mode == "Organisations engagées":
|
| 16 |
display_organisations_engagees()
|
| 17 |
elif app_mode == "Localisations":
|
| 18 |
display_map()
|
| 19 |
-
|
|
|
|
|
|
|
| 20 |
if __name__ == "__main__":
|
| 21 |
main()
|
|
|
|
| 1 |
import streamlit as st
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
from organisations_engagees import display_organisations_engagees
|
| 3 |
from localisation import display_map
|
| 4 |
+
from statistiques import main as display_statistics
|
| 5 |
|
| 6 |
# Main function orchestrating the app UI
|
| 7 |
def main():
|
| 8 |
st.sidebar.title("Navigation")
|
| 9 |
+
app_mode = st.sidebar.radio("Choisissez l'onglet", ["Organisations engagées", "Localisations", "Statistiques"])
|
| 10 |
|
| 11 |
if app_mode == "Organisations engagées":
|
| 12 |
display_organisations_engagees()
|
| 13 |
elif app_mode == "Localisations":
|
| 14 |
display_map()
|
| 15 |
+
elif app_mode == "Statistiques":
|
| 16 |
+
display_statistics()
|
| 17 |
+
|
| 18 |
if __name__ == "__main__":
|
| 19 |
main()
|
statistiques.py
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# statistiques.py
|
| 2 |
+
import streamlit as st
|
| 3 |
+
import pandas as pd
|
| 4 |
+
import plotly.express as px
|
| 5 |
+
from data_manager import get_data
|
| 6 |
+
|
| 7 |
+
def display_companies_by_sector(df):
|
| 8 |
+
sector_counts = df['Section NAF'].value_counts().reset_index()
|
| 9 |
+
sector_counts.columns = ['Secteur', 'Nombre']
|
| 10 |
+
fig = px.bar(sector_counts, x='Secteur', y='Nombre', title="Répartition des entreprises par secteur d'activité",
|
| 11 |
+
color='Nombre', labels={'Nombre':'Nombre d\'entreprises'}, template='plotly_white')
|
| 12 |
+
fig.update_layout(transition_duration=500)
|
| 13 |
+
st.plotly_chart(fig)
|
| 14 |
+
|
| 15 |
+
def display_company_sizes(df):
|
| 16 |
+
fig = px.histogram(df, x='tranche_effectif_entreprise', title="Distribution des tailles d'entreprises",
|
| 17 |
+
labels={'tranche_effectif_entreprise':'Taille de l\'entreprise'}, template='plotly_white')
|
| 18 |
+
fig.update_traces(marker_color='green')
|
| 19 |
+
st.plotly_chart(fig)
|
| 20 |
+
|
| 21 |
+
def display_rse_actions_wordcloud(df):
|
| 22 |
+
# Génération d'un nuage de mots serait normalement fait ici.
|
| 23 |
+
# Un placeholder pour l'intégration d'un vrai nuage de mots en utilisant une bibliothèque appropriée.
|
| 24 |
+
st.title("Cartographie des Actions RSE")
|
| 25 |
+
st.markdown("Cette section affichera un nuage de mots des actions RSE.")
|
| 26 |
+
|
| 27 |
+
def main():
|
| 28 |
+
st.title("Statistiques sur les entreprises engagées RSE")
|
| 29 |
+
data, _ = get_data()
|
| 30 |
+
df = pd.DataFrame(data)
|
| 31 |
+
|
| 32 |
+
if not df.empty:
|
| 33 |
+
display_companies_by_sector(df)
|
| 34 |
+
display_company_sizes(df)
|
| 35 |
+
display_rse_actions_wordcloud(df)
|
| 36 |
+
else:
|
| 37 |
+
st.write("Aucune donnée à afficher pour le moment.")
|
| 38 |
+
|
| 39 |
+
if __name__ == "__main__":
|
| 40 |
+
main()
|