Spaces:
Runtime error
Runtime error
Commit
·
70c976f
1
Parent(s):
9c5ca90
V2-Liste_MAP_Stat_10
Browse files- statistiques.py +12 -5
statistiques.py
CHANGED
|
@@ -4,7 +4,7 @@ import pandas as pd
|
|
| 4 |
import plotly.express as px
|
| 5 |
import matplotlib.pyplot as plt
|
| 6 |
from data_manager import get_data
|
| 7 |
-
from wordcloud import WordCloud
|
| 8 |
|
| 9 |
def display_companies_by_sector(df):
|
| 10 |
# Assurez-vous d'utiliser le nom correct de la colonne ici
|
|
@@ -26,17 +26,24 @@ def display_company_sizes(df):
|
|
| 26 |
def display_rse_actions_wordcloud(df):
|
| 27 |
st.title("Cartographie des Actions RSE")
|
| 28 |
|
| 29 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
text = " ".join(action for action in df['action_rse'].dropna())
|
| 31 |
|
| 32 |
-
# Génération du nuage de mots
|
| 33 |
-
wordcloud = WordCloud(
|
| 34 |
|
| 35 |
# Affichage du nuage de mots
|
| 36 |
fig, ax = plt.subplots()
|
| 37 |
ax.imshow(wordcloud, interpolation='bilinear')
|
| 38 |
-
ax.axis('off')
|
| 39 |
st.pyplot(fig)
|
|
|
|
| 40 |
|
| 41 |
def main():
|
| 42 |
st.title("Statistiques sur les entreprises engagées RSE")
|
|
|
|
| 4 |
import plotly.express as px
|
| 5 |
import matplotlib.pyplot as plt
|
| 6 |
from data_manager import get_data
|
| 7 |
+
from wordcloud import WordCloud,STOPWORDS
|
| 8 |
|
| 9 |
def display_companies_by_sector(df):
|
| 10 |
# Assurez-vous d'utiliser le nom correct de la colonne ici
|
|
|
|
| 26 |
def display_rse_actions_wordcloud(df):
|
| 27 |
st.title("Cartographie des Actions RSE")
|
| 28 |
|
| 29 |
+
# Définir les mots à exclure
|
| 30 |
+
custom_stopwords = set(["nous", "du", "notre", "de", "et", "est", "pour", "le", "une", "se", "en", "au", "à", "que", "sont", "leur", "son"])
|
| 31 |
+
|
| 32 |
+
# Ajouter vos mots à exclure aux stop words par défaut de wordcloud
|
| 33 |
+
stopwords = STOPWORDS.union(custom_stopwords)
|
| 34 |
+
|
| 35 |
+
# Préparation des données
|
| 36 |
text = " ".join(action for action in df['action_rse'].dropna())
|
| 37 |
|
| 38 |
+
# Génération du nuage de mots avec les stop words personnalisés
|
| 39 |
+
wordcloud = WordCloud(stopwords=stopwords, background_color="white", width=800, height=400).generate(text)
|
| 40 |
|
| 41 |
# Affichage du nuage de mots
|
| 42 |
fig, ax = plt.subplots()
|
| 43 |
ax.imshow(wordcloud, interpolation='bilinear')
|
| 44 |
+
ax.axis('off')
|
| 45 |
st.pyplot(fig)
|
| 46 |
+
|
| 47 |
|
| 48 |
def main():
|
| 49 |
st.title("Statistiques sur les entreprises engagées RSE")
|