datacipen commited on
Commit
d724221
·
verified ·
1 Parent(s): bcda7b4

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +17 -12
main.py CHANGED
@@ -156,61 +156,66 @@ async def chat_profile():
156
  async def on_chat_start():
157
  await cl.Message(f"> SURVEYIA").send()
158
  elements = []
 
159
  df = pd.read_csv('./public/survey.csv')
160
  df_taille = df.groupby('taille_entreprise').size().reset_index(name='obs')
161
  fig_taille = px.pie(df_taille, names='taille_entreprise', values='obs', color='obs', title="La taille des entreprises ayant répondu", labels={'obs':'nombre'}, color_discrete_sequence=px.colors.qualitative.Safe).update_traces(textposition='inside', textinfo='percent+label').update_layout(font=dict(size=9,color="RebeccaPurple"))
162
  elements.append(cl.Plotly(name="chart_taille", figure=fig_taille, display="inline", size="small"))
163
- await cl.sleep(2)
 
 
 
 
164
  df_temps = df.groupby('temps_active_domaine_agencement').size().reset_index(name='obs')
165
  fig_temps = px.pie(df_temps, names='temps_active_domaine_agencement', values='obs', color='obs', title="L’engagement dans le domaine de l’agencement", labels={'obs':'nombre'}, color_discrete_sequence=px.colors.qualitative.Safe).update_traces(textposition='inside', textinfo='percent+label').update_layout(font=dict(size=9,color="RebeccaPurple"))
166
  elements.append(cl.Plotly(name="chart_temps", figure=fig_temps, display="inline", size="small"))
167
- await cl.sleep(2)
168
  df_temps_entreprise = df.groupby(['temps_active_domaine_agencement', 'taille_entreprise']).size().reset_index(name='obs')
169
  fig_temps_entreprise = px.bar(df_temps_entreprise, x='temps_active_domaine_agencement', y='obs', color='taille_entreprise', title="L’engagement dans le domaine de l’agencement par taille d'entreprise", labels={'obs':'nombre'}, color_discrete_sequence=px.colors.qualitative.Safe, text_auto=True).update_layout(font=dict(size=9,color="RebeccaPurple"))
170
  elements.append(cl.Plotly(name="chart_temps_entreprise", figure=fig_temps_entreprise, display="inline", size="small"))
171
- await cl.sleep(2)
172
  df_nb_charge = df.groupby('nombre_chargés_affaires').size().reset_index(name='obs')
173
  fig_nb_charge = px.pie(df_nb_charge, names='nombre_chargés_affaires', values='obs', color='obs', title="Le nombre de chargé.e d’affaires en agencement", labels={'obs':'nombre'}, color_discrete_sequence=px.colors.qualitative.Safe).update_traces(textposition='inside', textinfo='percent+label').update_layout(font=dict(size=9,color="RebeccaPurple"))
174
  elements.append(cl.Plotly(name="chart_nb_charge", figure=fig_nb_charge, display="inline", size="small"))
175
- await cl.sleep(2)
176
  df_nb_charge_entreprise = df.groupby(['nombre_chargés_affaires', 'taille_entreprise']).size().reset_index(name='obs')
177
  fig_nb_charge_entreprise = px.bar(df_nb_charge_entreprise, x='nombre_chargés_affaires', y='obs', color='taille_entreprise', title="Le nombre de chargé.e d’affaires en agencement par taille d'entreprise", labels={'obs':'nombre'}, color_discrete_sequence=px.colors.qualitative.Safe, text_auto=True).update_layout(font=dict(size=9,color="RebeccaPurple"))
178
  elements.append(cl.Plotly(name="chart_nb_charge_entreprise", figure=fig_nb_charge_entreprise, display="inline", size="small"))
179
- await cl.sleep(2)
180
  df_nb_charge_engagement = df.groupby(['nombre_chargés_affaires', 'temps_active_domaine_agencement']).size().reset_index(name='obs')
181
  fig_nb_charge_entreprise = px.bar(df_nb_charge_engagement, x='nombre_chargés_affaires', y='obs', color='temps_active_domaine_agencement', title="Le nombre de chargé.e d’affaires en agencement par année d'engagement", labels={'obs':'nombre'}, color_discrete_sequence=px.colors.qualitative.Safe, text_auto=True).update_layout(font=dict(size=9,color="RebeccaPurple"))
182
  elements.append(cl.Plotly(name="chart_nb_charge_entreprise", figure=fig_nb_charge_entreprise, display="inline", size="small"))
183
- await cl.sleep(2)
184
  df_statut = df.groupby('fonction_Statut_repondant').size().reset_index(name='obs')
185
  fig_statut = px.bar(df_statut, x='obs', y='fonction_Statut_repondant', orientation='h', color='obs', title="Le profil des répondants", labels={'obs':'nombre'}, color_discrete_sequence=px.colors.qualitative.Safe, text_auto=True).update_layout(font=dict(size=9,color="RebeccaPurple"))
186
  elements.append(cl.Plotly(name="chart_statut", figure=fig_statut, display="inline", size="small"))
187
- await cl.sleep(2)
188
  df1 = df
189
  df1['principaux_interlocuteurs'] = df1['principaux_interlocuteurs'].str.split(';')
190
  df1 = df1.explode('principaux_interlocuteurs')
191
  df_interlocuteur = df1.groupby('principaux_interlocuteurs').size().reset_index(name='obs')
192
  fig_interlocuteur = px.bar(df_interlocuteur, x='obs', y='principaux_interlocuteurs', orientation='h', color='obs', title="Les principaux interlocuteurs du CAA", labels={'obs':'nombre'}, color_discrete_sequence=px.colors.qualitative.Safe, text_auto=True).update_layout(font=dict(size=9,color="RebeccaPurple"))
193
  elements.append(cl.Plotly(name="chart_interlocuteur", figure=fig_interlocuteur, display="inline", size="small"))
194
- await cl.sleep(2)
195
  df_interlocuteur_entreprise = df1.groupby(['principaux_interlocuteurs', 'taille_entreprise']).size().reset_index(name='obs')
196
  fig_interlocuteur_entreprise = px.bar(df_interlocuteur_entreprise, x='obs', y='principaux_interlocuteurs', orientation='h', color='taille_entreprise', title="Les principaux interlocuteurs du CAA par taille d'entreprise", labels={'obs':'nombre'}, color_discrete_sequence=px.colors.qualitative.Safe, text_auto=True).update_layout(font=dict(size=9,color="RebeccaPurple"))
197
  elements.append(cl.Plotly(name="chart_interlocuteur_entreprise", figure=fig_interlocuteur_entreprise, display="inline", size="small"))
198
- await cl.sleep(2)
199
  df_interlocuteur_nb_charge = df1.groupby(['principaux_interlocuteurs', 'nombre_chargés_affaires']).size().reset_index(name='obs')
200
  fig_interlocuteur_nb_charge = px.bar(df_interlocuteur_nb_charge, x='obs', y='principaux_interlocuteurs', orientation='h', color='nombre_chargés_affaires', title="Les principaux interlocuteurs du CAA par nombre chargé.e d'affaires", labels={'obs':'nombre'}, color_discrete_sequence=px.colors.qualitative.Safe, text_auto=True).update_layout(font=dict(size=9,color="RebeccaPurple"))
201
  elements.append(cl.Plotly(name="chart_interlocuteur_nb_charge", figure=fig_interlocuteur_nb_charge, display="inline", size="small"))
202
- await cl.sleep(2)
203
  df2 = df
204
  df2['principales_compétences_attendues'] = df2['principales_compétences_attendues'].str.split(';')
205
  df2 = df2.explode('principales_compétences_attendues')
206
  df_competences = df2.groupby('principales_compétences_attendues').size().reset_index(name='obs')
207
  fig_competences = px.bar(df_competences, x='obs', y='principales_compétences_attendues', orientation='h', color='obs', title="Les principales compétences attendues", labels={'obs':'nombre'}, color_discrete_sequence=px.colors.qualitative.Safe, text_auto=True).update_layout(font=dict(size=9,color="RebeccaPurple"))
208
  elements.append(cl.Plotly(name="chart_competences", figure=fig_competences, display="inline", size="small"))
209
- await cl.sleep(2)
210
  df_competences_entreprise = df2.groupby(['principales_compétences_attendues', 'taille_entreprise']).size().reset_index(name='obs')
211
  fig_competences_entreprise = px.bar(df_competences_entreprise, x='obs', y='principales_compétences_attendues', orientation='h', color='taille_entreprise', title="Les principales compétences attendues par taille d'entreprise", labels={'obs':'nombre'}, color_discrete_sequence=px.colors.qualitative.Safe, text_auto=True).update_layout(font=dict(size=9,color="RebeccaPurple"))
212
  elements.append(cl.Plotly(name="chart_competences_entreprise", figure=fig_competences_entreprise, display="inline", size="small"))
213
- await cl.sleep(2)
214
  df_competences_nb_charge = df2.groupby(['principales_compétences_attendues', 'nombre_chargés_affaires']).size().reset_index(name='obs')
215
  fig_competences_nb_charge = px.bar(df_competences_nb_charge, x='obs', y='principales_compétences_attendues', orientation='h', color='nombre_chargés_affaires', title="Les principales compétences attendues par nombre chargé.e d'affaires", labels={'obs':'nombre'}, color_discrete_sequence=px.colors.qualitative.Safe, text_auto=True).update_layout(font=dict(size=9,color="RebeccaPurple"))
216
  elements.append(cl.Plotly(name="chart_competences_nb_charge", figure=fig_competences_nb_charge, display="inline", size="small"))
 
156
  async def on_chat_start():
157
  await cl.Message(f"> SURVEYIA").send()
158
  elements = []
159
+ textElements = []
160
  df = pd.read_csv('./public/survey.csv')
161
  df_taille = df.groupby('taille_entreprise').size().reset_index(name='obs')
162
  fig_taille = px.pie(df_taille, names='taille_entreprise', values='obs', color='obs', title="La taille des entreprises ayant répondu", labels={'obs':'nombre'}, color_discrete_sequence=px.colors.qualitative.Safe).update_traces(textposition='inside', textinfo='percent+label').update_layout(font=dict(size=9,color="RebeccaPurple"))
163
  elements.append(cl.Plotly(name="chart_taille", figure=fig_taille, display="inline", size="small"))
164
+
165
+ textElements.append(cl.Text(name="text_taille", content=df_taille.style.applymap(), display="side"))
166
+ await cl.Message(content="Tableau des données de La \"taille des entreprises ayant répondu\"", elements=textElements,).send()
167
+
168
+ #await cl.sleep(2)
169
  df_temps = df.groupby('temps_active_domaine_agencement').size().reset_index(name='obs')
170
  fig_temps = px.pie(df_temps, names='temps_active_domaine_agencement', values='obs', color='obs', title="L’engagement dans le domaine de l’agencement", labels={'obs':'nombre'}, color_discrete_sequence=px.colors.qualitative.Safe).update_traces(textposition='inside', textinfo='percent+label').update_layout(font=dict(size=9,color="RebeccaPurple"))
171
  elements.append(cl.Plotly(name="chart_temps", figure=fig_temps, display="inline", size="small"))
172
+ #await cl.sleep(2)
173
  df_temps_entreprise = df.groupby(['temps_active_domaine_agencement', 'taille_entreprise']).size().reset_index(name='obs')
174
  fig_temps_entreprise = px.bar(df_temps_entreprise, x='temps_active_domaine_agencement', y='obs', color='taille_entreprise', title="L’engagement dans le domaine de l’agencement par taille d'entreprise", labels={'obs':'nombre'}, color_discrete_sequence=px.colors.qualitative.Safe, text_auto=True).update_layout(font=dict(size=9,color="RebeccaPurple"))
175
  elements.append(cl.Plotly(name="chart_temps_entreprise", figure=fig_temps_entreprise, display="inline", size="small"))
176
+ #await cl.sleep(2)
177
  df_nb_charge = df.groupby('nombre_chargés_affaires').size().reset_index(name='obs')
178
  fig_nb_charge = px.pie(df_nb_charge, names='nombre_chargés_affaires', values='obs', color='obs', title="Le nombre de chargé.e d’affaires en agencement", labels={'obs':'nombre'}, color_discrete_sequence=px.colors.qualitative.Safe).update_traces(textposition='inside', textinfo='percent+label').update_layout(font=dict(size=9,color="RebeccaPurple"))
179
  elements.append(cl.Plotly(name="chart_nb_charge", figure=fig_nb_charge, display="inline", size="small"))
180
+ #await cl.sleep(2)
181
  df_nb_charge_entreprise = df.groupby(['nombre_chargés_affaires', 'taille_entreprise']).size().reset_index(name='obs')
182
  fig_nb_charge_entreprise = px.bar(df_nb_charge_entreprise, x='nombre_chargés_affaires', y='obs', color='taille_entreprise', title="Le nombre de chargé.e d’affaires en agencement par taille d'entreprise", labels={'obs':'nombre'}, color_discrete_sequence=px.colors.qualitative.Safe, text_auto=True).update_layout(font=dict(size=9,color="RebeccaPurple"))
183
  elements.append(cl.Plotly(name="chart_nb_charge_entreprise", figure=fig_nb_charge_entreprise, display="inline", size="small"))
184
+ #await cl.sleep(2)
185
  df_nb_charge_engagement = df.groupby(['nombre_chargés_affaires', 'temps_active_domaine_agencement']).size().reset_index(name='obs')
186
  fig_nb_charge_entreprise = px.bar(df_nb_charge_engagement, x='nombre_chargés_affaires', y='obs', color='temps_active_domaine_agencement', title="Le nombre de chargé.e d’affaires en agencement par année d'engagement", labels={'obs':'nombre'}, color_discrete_sequence=px.colors.qualitative.Safe, text_auto=True).update_layout(font=dict(size=9,color="RebeccaPurple"))
187
  elements.append(cl.Plotly(name="chart_nb_charge_entreprise", figure=fig_nb_charge_entreprise, display="inline", size="small"))
188
+ #await cl.sleep(2)
189
  df_statut = df.groupby('fonction_Statut_repondant').size().reset_index(name='obs')
190
  fig_statut = px.bar(df_statut, x='obs', y='fonction_Statut_repondant', orientation='h', color='obs', title="Le profil des répondants", labels={'obs':'nombre'}, color_discrete_sequence=px.colors.qualitative.Safe, text_auto=True).update_layout(font=dict(size=9,color="RebeccaPurple"))
191
  elements.append(cl.Plotly(name="chart_statut", figure=fig_statut, display="inline", size="small"))
192
+ #await cl.sleep(2)
193
  df1 = df
194
  df1['principaux_interlocuteurs'] = df1['principaux_interlocuteurs'].str.split(';')
195
  df1 = df1.explode('principaux_interlocuteurs')
196
  df_interlocuteur = df1.groupby('principaux_interlocuteurs').size().reset_index(name='obs')
197
  fig_interlocuteur = px.bar(df_interlocuteur, x='obs', y='principaux_interlocuteurs', orientation='h', color='obs', title="Les principaux interlocuteurs du CAA", labels={'obs':'nombre'}, color_discrete_sequence=px.colors.qualitative.Safe, text_auto=True).update_layout(font=dict(size=9,color="RebeccaPurple"))
198
  elements.append(cl.Plotly(name="chart_interlocuteur", figure=fig_interlocuteur, display="inline", size="small"))
199
+ #await cl.sleep(2)
200
  df_interlocuteur_entreprise = df1.groupby(['principaux_interlocuteurs', 'taille_entreprise']).size().reset_index(name='obs')
201
  fig_interlocuteur_entreprise = px.bar(df_interlocuteur_entreprise, x='obs', y='principaux_interlocuteurs', orientation='h', color='taille_entreprise', title="Les principaux interlocuteurs du CAA par taille d'entreprise", labels={'obs':'nombre'}, color_discrete_sequence=px.colors.qualitative.Safe, text_auto=True).update_layout(font=dict(size=9,color="RebeccaPurple"))
202
  elements.append(cl.Plotly(name="chart_interlocuteur_entreprise", figure=fig_interlocuteur_entreprise, display="inline", size="small"))
203
+ #await cl.sleep(2)
204
  df_interlocuteur_nb_charge = df1.groupby(['principaux_interlocuteurs', 'nombre_chargés_affaires']).size().reset_index(name='obs')
205
  fig_interlocuteur_nb_charge = px.bar(df_interlocuteur_nb_charge, x='obs', y='principaux_interlocuteurs', orientation='h', color='nombre_chargés_affaires', title="Les principaux interlocuteurs du CAA par nombre chargé.e d'affaires", labels={'obs':'nombre'}, color_discrete_sequence=px.colors.qualitative.Safe, text_auto=True).update_layout(font=dict(size=9,color="RebeccaPurple"))
206
  elements.append(cl.Plotly(name="chart_interlocuteur_nb_charge", figure=fig_interlocuteur_nb_charge, display="inline", size="small"))
207
+ #await cl.sleep(2)
208
  df2 = df
209
  df2['principales_compétences_attendues'] = df2['principales_compétences_attendues'].str.split(';')
210
  df2 = df2.explode('principales_compétences_attendues')
211
  df_competences = df2.groupby('principales_compétences_attendues').size().reset_index(name='obs')
212
  fig_competences = px.bar(df_competences, x='obs', y='principales_compétences_attendues', orientation='h', color='obs', title="Les principales compétences attendues", labels={'obs':'nombre'}, color_discrete_sequence=px.colors.qualitative.Safe, text_auto=True).update_layout(font=dict(size=9,color="RebeccaPurple"))
213
  elements.append(cl.Plotly(name="chart_competences", figure=fig_competences, display="inline", size="small"))
214
+ #await cl.sleep(2)
215
  df_competences_entreprise = df2.groupby(['principales_compétences_attendues', 'taille_entreprise']).size().reset_index(name='obs')
216
  fig_competences_entreprise = px.bar(df_competences_entreprise, x='obs', y='principales_compétences_attendues', orientation='h', color='taille_entreprise', title="Les principales compétences attendues par taille d'entreprise", labels={'obs':'nombre'}, color_discrete_sequence=px.colors.qualitative.Safe, text_auto=True).update_layout(font=dict(size=9,color="RebeccaPurple"))
217
  elements.append(cl.Plotly(name="chart_competences_entreprise", figure=fig_competences_entreprise, display="inline", size="small"))
218
+ #await cl.sleep(2)
219
  df_competences_nb_charge = df2.groupby(['principales_compétences_attendues', 'nombre_chargés_affaires']).size().reset_index(name='obs')
220
  fig_competences_nb_charge = px.bar(df_competences_nb_charge, x='obs', y='principales_compétences_attendues', orientation='h', color='nombre_chargés_affaires', title="Les principales compétences attendues par nombre chargé.e d'affaires", labels={'obs':'nombre'}, color_discrete_sequence=px.colors.qualitative.Safe, text_auto=True).update_layout(font=dict(size=9,color="RebeccaPurple"))
221
  elements.append(cl.Plotly(name="chart_competences_nb_charge", figure=fig_competences_nb_charge, display="inline", size="small"))