Commit
·
2348b43
1
Parent(s):
f232c49
V2-Liste_MAP_Stat_05
Browse files- statistiques.py +5 -3
statistiques.py
CHANGED
|
@@ -5,7 +5,8 @@ import plotly.express as px
|
|
| 5 |
from data_manager import get_data
|
| 6 |
|
| 7 |
def display_companies_by_sector(df):
|
| 8 |
-
|
|
|
|
| 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')
|
|
@@ -13,14 +14,13 @@ def display_companies_by_sector(df):
|
|
| 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 |
|
|
@@ -29,7 +29,9 @@ def main():
|
|
| 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)
|
|
|
|
| 5 |
from data_manager import get_data
|
| 6 |
|
| 7 |
def display_companies_by_sector(df):
|
| 8 |
+
# Assurez-vous d'utiliser le nom correct de la colonne ici
|
| 9 |
+
sector_counts = df['Section NAF'].value_counts().reset_index()
|
| 10 |
sector_counts.columns = ['Secteur', 'Nombre']
|
| 11 |
fig = px.bar(sector_counts, x='Secteur', y='Nombre', title="Répartition des entreprises par secteur d'activité",
|
| 12 |
color='Nombre', labels={'Nombre':'Nombre d\'entreprises'}, template='plotly_white')
|
|
|
|
| 14 |
st.plotly_chart(fig)
|
| 15 |
|
| 16 |
def display_company_sizes(df):
|
| 17 |
+
# Remplacez 'tranche_effectif_entreprise' par le nom correct de la colonne
|
| 18 |
fig = px.histogram(df, x='tranche_effectif_entreprise', title="Distribution des tailles d'entreprises",
|
| 19 |
labels={'tranche_effectif_entreprise':'Taille de l\'entreprise'}, template='plotly_white')
|
| 20 |
fig.update_traces(marker_color='green')
|
| 21 |
st.plotly_chart(fig)
|
| 22 |
|
| 23 |
def display_rse_actions_wordcloud(df):
|
|
|
|
|
|
|
| 24 |
st.title("Cartographie des Actions RSE")
|
| 25 |
st.markdown("Cette section affichera un nuage de mots des actions RSE.")
|
| 26 |
|
|
|
|
| 29 |
data, _ = get_data()
|
| 30 |
df = pd.DataFrame(data)
|
| 31 |
|
| 32 |
+
# Affiche les noms des colonnes du DataFrame
|
| 33 |
if not df.empty:
|
| 34 |
+
st.write("Colonnes du DataFrame:", df.columns.tolist())
|
| 35 |
display_companies_by_sector(df)
|
| 36 |
display_company_sizes(df)
|
| 37 |
display_rse_actions_wordcloud(df)
|