File size: 1,693 Bytes
a94f73c
 
 
 
 
 
 
f66144d
 
a94f73c
 
 
 
 
 
 
f66144d
a94f73c
 
 
 
 
 
 
 
 
 
 
 
 
 
f66144d
a94f73c
f66144d
a94f73c
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# statistiques.py
import streamlit as st
import pandas as pd
import plotly.express as px
from data_manager import get_data

def display_companies_by_sector(df):
    # Assurez-vous d'utiliser le nom correct de la colonne ici
    sector_counts = df['Section NAF'].value_counts().reset_index()
    sector_counts.columns = ['Secteur', 'Nombre']
    fig = px.bar(sector_counts, x='Secteur', y='Nombre', title="Répartition des entreprises par secteur d'activité",
                 color='Nombre', labels={'Nombre':'Nombre d\'entreprises'}, template='plotly_white')
    fig.update_layout(transition_duration=500)
    st.plotly_chart(fig)

def display_company_sizes(df):
    # Remplacez 'tranche_effectif_entreprise' par le nom correct de la colonne
    fig = px.histogram(df, x='tranche_effectif_entreprise', title="Distribution des tailles d'entreprises",
                       labels={'tranche_effectif_entreprise':'Taille de l\'entreprise'}, template='plotly_white')
    fig.update_traces(marker_color='green')
    st.plotly_chart(fig)

def display_rse_actions_wordcloud(df):
    st.title("Cartographie des Actions RSE")
    st.markdown("Cette section affichera un nuage de mots des actions RSE.")

def main():
    st.title("Statistiques sur les entreprises engagées RSE")
    data, _ = get_data()
    df = pd.DataFrame(data)
    
    # Affiche les noms des colonnes du DataFrame
    if not df.empty:
        st.write("Colonnes du DataFrame:", df.columns.tolist())
        display_companies_by_sector(df)
        display_company_sizes(df)
        display_rse_actions_wordcloud(df)
    else:
        st.write("Aucune donnée à afficher pour le moment.")

if __name__ == "__main__":
    main()