Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -996,7 +996,7 @@ def create_contrat(df, customEmplois, theme):
|
|
996 |
|
997 |
return fig_contrat
|
998 |
|
999 |
-
def create_experience(df, theme):
|
1000 |
if theme == "dark":
|
1001 |
template = "plotly_dark"
|
1002 |
paper_bgcolor = 'rgba(36, 36, 36, 1)'
|
@@ -1005,7 +1005,9 @@ def create_experience(df, theme):
|
|
1005 |
paper_bgcolor = 'rgba(255, 255, 255, 1)'
|
1006 |
######## Expériences professionnelles ########
|
1007 |
df_experience = df.groupby('experienceLibelle').size().reset_index(name='obs')
|
1008 |
-
fig_experience = px.pie(df_experience, names='experienceLibelle', values='obs', color='obs', height=600, template=template,
|
|
|
|
|
1009 |
|
1010 |
return fig_experience
|
1011 |
|
@@ -1117,7 +1119,7 @@ def update_emploi(selectedData, array_value, theme):
|
|
1117 |
@callback(
|
1118 |
Output(component_id='figContrats', component_property='figure'),
|
1119 |
Input('figRepartition', 'selectedData'),
|
1120 |
-
Input('figEmplois', '
|
1121 |
Input(component_id='framework-multi-select', component_property='value'),
|
1122 |
Input("mantine-provider", "forceColorScheme"),
|
1123 |
)
|
@@ -1162,12 +1164,16 @@ def update_contrat(selectedData, selectedDataEmplois, array_value, theme):
|
|
1162 |
@callback(
|
1163 |
Output(component_id='figExperiences', component_property='figure'),
|
1164 |
Input('figRepartition', 'selectedData'),
|
|
|
1165 |
Input(component_id='framework-multi-select', component_property='value'),
|
1166 |
Input("mantine-provider", "forceColorScheme"),
|
1167 |
)
|
1168 |
|
1169 |
-
def update_experience(selectedData, array_value, theme):
|
|
|
|
|
1170 |
options = []
|
|
|
1171 |
if selectedData != None:
|
1172 |
if type(selectedData['points'][0]['hovertext']) == str:
|
1173 |
options.append(selectedData['points'][0]['hovertext'])
|
@@ -1175,9 +1181,15 @@ def update_experience(selectedData, array_value, theme):
|
|
1175 |
options = selectedData['points'][0]['hovertext']
|
1176 |
else:
|
1177 |
options = ['01','02','03','04','05','06','07','08','09','10','11','12','13','14','15','16','17','18','19','2A','2B','21','22','23','24','25','26','27','28','29','30','31','32','33','34','35','36','37','38','39','40','41','42','43','44','45','46','47','48','49','50','51','52','53','54','55','56','57','58','59','60','61','62','63','64','65','66','67','68','69','70','71','72','73','74','75','76','77','78','79','80','81','82','83','84','85','86','87','88','89','90','91','92','93','94','95','971','972','973','974']
|
1178 |
-
|
1179 |
-
|
1180 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
1181 |
df["lieuTravail"] = df["lieuTravail"].apply(lambda x: x['libelle']).apply(lambda x: x[0:3]).apply(lambda x: x.strip())
|
1182 |
df.drop(df[df['lieuTravail'] == 'Fra'].index, inplace = True)
|
1183 |
df.drop(df[df['lieuTravail'] == 'FRA'].index, inplace = True)
|
@@ -1186,8 +1198,8 @@ def update_experience(selectedData, array_value, theme):
|
|
1186 |
df.drop(df[df['lieuTravail'] == 'Bou'].index, inplace = True)
|
1187 |
df.drop(df[df['lieuTravail'] == '976'].index, inplace = True)
|
1188 |
df = df[df['lieuTravail'].isin(options)]
|
1189 |
-
|
1190 |
-
return create_experience(df, theme)
|
1191 |
|
1192 |
@callback(
|
1193 |
Output(component_id='tableauEmplois', component_property='children'),
|
|
|
996 |
|
997 |
return fig_contrat
|
998 |
|
999 |
+
def create_experience(df, customEmplois, theme):
|
1000 |
if theme == "dark":
|
1001 |
template = "plotly_dark"
|
1002 |
paper_bgcolor = 'rgba(36, 36, 36, 1)'
|
|
|
1005 |
paper_bgcolor = 'rgba(255, 255, 255, 1)'
|
1006 |
######## Expériences professionnelles ########
|
1007 |
df_experience = df.groupby('experienceLibelle').size().reset_index(name='obs')
|
1008 |
+
fig_experience = px.pie(df_experience, names='experienceLibelle', values='obs', color='obs', height=600, template=template, labels={'obs':'nombre'}, color_discrete_sequence=px.colors.qualitative.Safe).update_traces(textposition='inside', textinfo='percent+label').update_layout(font=dict(size=10),paper_bgcolor=paper_bgcolor).add_annotation(x=0, y=1.0, xanchor='left', yanchor='bottom',
|
1009 |
+
xref='paper', yref='paper', showarrow=False, align='left',
|
1010 |
+
text='Les expériences professionnelles<br><b>{}</b>'.format(customEmplois),font=dict(size=14))
|
1011 |
|
1012 |
return fig_experience
|
1013 |
|
|
|
1119 |
@callback(
|
1120 |
Output(component_id='figContrats', component_property='figure'),
|
1121 |
Input('figRepartition', 'selectedData'),
|
1122 |
+
Input('figEmplois', 'selectedData'),
|
1123 |
Input(component_id='framework-multi-select', component_property='value'),
|
1124 |
Input("mantine-provider", "forceColorScheme"),
|
1125 |
)
|
|
|
1164 |
@callback(
|
1165 |
Output(component_id='figExperiences', component_property='figure'),
|
1166 |
Input('figRepartition', 'selectedData'),
|
1167 |
+
Input('figEmplois', 'selectedData'),
|
1168 |
Input(component_id='framework-multi-select', component_property='value'),
|
1169 |
Input("mantine-provider", "forceColorScheme"),
|
1170 |
)
|
1171 |
|
1172 |
+
def update_experience(selectedData, selectedDataEmplois, array_value, theme):
|
1173 |
+
df_FT = API_France_Travail(array_value)
|
1174 |
+
df = df_FT[['intitule','typeContratLibelle','experienceLibelle','lieuTravail']].copy()
|
1175 |
options = []
|
1176 |
+
options_FT = []
|
1177 |
if selectedData != None:
|
1178 |
if type(selectedData['points'][0]['hovertext']) == str:
|
1179 |
options.append(selectedData['points'][0]['hovertext'])
|
|
|
1181 |
options = selectedData['points'][0]['hovertext']
|
1182 |
else:
|
1183 |
options = ['01','02','03','04','05','06','07','08','09','10','11','12','13','14','15','16','17','18','19','2A','2B','21','22','23','24','25','26','27','28','29','30','31','32','33','34','35','36','37','38','39','40','41','42','43','44','45','46','47','48','49','50','51','52','53','54','55','56','57','58','59','60','61','62','63','64','65','66','67','68','69','70','71','72','73','74','75','76','77','78','79','80','81','82','83','84','85','86','87','88','89','90','91','92','93','94','95','971','972','973','974']
|
1184 |
+
if selectedDataEmplois != None:
|
1185 |
+
customEmplois = selectedDataEmplois['points'][0]['y'][:-3]
|
1186 |
+
if type(selectedDataEmplois['points'][0]['y']) == str:
|
1187 |
+
options_FT.append(selectedDataEmplois['points'][0]['y'][:-3])
|
1188 |
+
else:
|
1189 |
+
options_FT = selectedDataEmplois['points'][0]['y'][:-3]
|
1190 |
+
else:
|
1191 |
+
customEmplois = " "
|
1192 |
+
options_FT = df['intitule'].values.tolist()
|
1193 |
df["lieuTravail"] = df["lieuTravail"].apply(lambda x: x['libelle']).apply(lambda x: x[0:3]).apply(lambda x: x.strip())
|
1194 |
df.drop(df[df['lieuTravail'] == 'Fra'].index, inplace = True)
|
1195 |
df.drop(df[df['lieuTravail'] == 'FRA'].index, inplace = True)
|
|
|
1198 |
df.drop(df[df['lieuTravail'] == 'Bou'].index, inplace = True)
|
1199 |
df.drop(df[df['lieuTravail'] == '976'].index, inplace = True)
|
1200 |
df = df[df['lieuTravail'].isin(options)]
|
1201 |
+
df = df[df['intitule'].isin(options_FT)]
|
1202 |
+
return create_experience(df, customEmplois, theme)
|
1203 |
|
1204 |
@callback(
|
1205 |
Output(component_id='tableauEmplois', component_property='children'),
|