Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -980,7 +980,7 @@ def create_emploi(df, theme, customRepartition):
|
|
980 |
|
981 |
return fig_intitule
|
982 |
|
983 |
-
def create_contrat(df, theme):
|
984 |
if theme == "dark":
|
985 |
template = "plotly_dark"
|
986 |
paper_bgcolor = 'rgba(36, 36, 36, 1)'
|
@@ -990,7 +990,9 @@ def create_contrat(df, theme):
|
|
990 |
|
991 |
######## Types de contrat ########
|
992 |
df_contrat = df.groupby('typeContratLibelle').size().reset_index(name='obs')
|
993 |
-
fig_contrat = px.pie(df_contrat, names='typeContratLibelle', values='obs', color='obs', height=600, template=template,
|
|
|
|
|
994 |
|
995 |
return fig_contrat
|
996 |
|
@@ -1116,11 +1118,17 @@ def update_emploi(selectedData, array_value, theme):
|
|
1116 |
Output(component_id='figContrats', component_property='figure'),
|
1117 |
Input('figRepartition', 'selectedData'),
|
1118 |
Input(component_id='framework-multi-select', component_property='value'),
|
|
|
1119 |
Input("mantine-provider", "forceColorScheme"),
|
1120 |
)
|
1121 |
|
1122 |
-
def update_contrat(selectedData, array_value, theme):
|
|
|
|
|
|
|
1123 |
options = []
|
|
|
|
|
1124 |
if selectedData != None:
|
1125 |
if type(selectedData['points'][0]['hovertext']) == str:
|
1126 |
options.append(selectedData['points'][0]['hovertext'])
|
@@ -1129,8 +1137,16 @@ def update_contrat(selectedData, array_value, theme):
|
|
1129 |
else:
|
1130 |
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']
|
1131 |
|
1132 |
-
|
1133 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1134 |
df["lieuTravail"] = df["lieuTravail"].apply(lambda x: x['libelle']).apply(lambda x: x[0:3]).apply(lambda x: x.strip())
|
1135 |
df.drop(df[df['lieuTravail'] == 'Fra'].index, inplace = True)
|
1136 |
df.drop(df[df['lieuTravail'] == 'FRA'].index, inplace = True)
|
@@ -1139,8 +1155,9 @@ def update_contrat(selectedData, array_value, theme):
|
|
1139 |
df.drop(df[df['lieuTravail'] == 'Bou'].index, inplace = True)
|
1140 |
df.drop(df[df['lieuTravail'] == '976'].index, inplace = True)
|
1141 |
df = df[df['lieuTravail'].isin(options)]
|
|
|
1142 |
|
1143 |
-
return create_contrat(df, theme)
|
1144 |
|
1145 |
@callback(
|
1146 |
Output(component_id='figExperiences', component_property='figure'),
|
|
|
980 |
|
981 |
return fig_intitule
|
982 |
|
983 |
+
def create_contrat(df, customEmplois, theme):
|
984 |
if theme == "dark":
|
985 |
template = "plotly_dark"
|
986 |
paper_bgcolor = 'rgba(36, 36, 36, 1)'
|
|
|
990 |
|
991 |
######## Types de contrat ########
|
992 |
df_contrat = df.groupby('typeContratLibelle').size().reset_index(name='obs')
|
993 |
+
fig_contrat = px.pie(df_contrat, names='typeContratLibelle', 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',
|
994 |
+
xref='paper', yref='paper', showarrow=False, align='left',
|
995 |
+
text='Les types de contrat<br><b>{}</b>'.format(customEmplois),font=dict(size=14))
|
996 |
|
997 |
return fig_contrat
|
998 |
|
|
|
1118 |
Output(component_id='figContrats', component_property='figure'),
|
1119 |
Input('figRepartition', 'selectedData'),
|
1120 |
Input(component_id='framework-multi-select', component_property='value'),
|
1121 |
+
Input('figEmplois', 'selectedDataEmplois'),
|
1122 |
Input("mantine-provider", "forceColorScheme"),
|
1123 |
)
|
1124 |
|
1125 |
+
def update_contrat(selectedData, array_value, selectedDataEmplois, theme):
|
1126 |
+
df_FT = API_France_Travail(array_value)
|
1127 |
+
df = df_FT[['intitule','typeContratLibelle','experienceLibelle','lieuTravail']].copy()
|
1128 |
+
|
1129 |
options = []
|
1130 |
+
options_FT = []
|
1131 |
+
|
1132 |
if selectedData != None:
|
1133 |
if type(selectedData['points'][0]['hovertext']) == str:
|
1134 |
options.append(selectedData['points'][0]['hovertext'])
|
|
|
1137 |
else:
|
1138 |
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']
|
1139 |
|
1140 |
+
if selectedDataEmplois != None:
|
1141 |
+
customEmplois = selectedDataEmplois['points'][0]['y'][:-3]
|
1142 |
+
if type(selectedDataEmplois['points'][0]['y']) == str:
|
1143 |
+
options_FT.append(selectedDataEmplois['points'][0]['y'][:-3])
|
1144 |
+
else:
|
1145 |
+
options_FT = selectedDataEmplois['points'][0]['y'][:-3]
|
1146 |
+
else:
|
1147 |
+
customEmplois = " "
|
1148 |
+
options_FT = df['intitule'].values.tolist()
|
1149 |
+
|
1150 |
df["lieuTravail"] = df["lieuTravail"].apply(lambda x: x['libelle']).apply(lambda x: x[0:3]).apply(lambda x: x.strip())
|
1151 |
df.drop(df[df['lieuTravail'] == 'Fra'].index, inplace = True)
|
1152 |
df.drop(df[df['lieuTravail'] == 'FRA'].index, inplace = True)
|
|
|
1155 |
df.drop(df[df['lieuTravail'] == 'Bou'].index, inplace = True)
|
1156 |
df.drop(df[df['lieuTravail'] == '976'].index, inplace = True)
|
1157 |
df = df[df['lieuTravail'].isin(options)]
|
1158 |
+
df = df[df['intitule'].isin(options_FT)]
|
1159 |
|
1160 |
+
return create_contrat(df, customEmplois, theme)
|
1161 |
|
1162 |
@callback(
|
1163 |
Output(component_id='figExperiences', component_property='figure'),
|