Skip to content

Commit

Permalink
Changement de logique pour column
Browse files Browse the repository at this point in the history
  • Loading branch information
creacress committed Oct 27, 2023
1 parent 149e8a3 commit 8caaab5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
6 changes: 6 additions & 0 deletions Correspondance/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"[python]": {
"editor.defaultFormatter": "ms-python.python"
},
"python.formatting.provider": "none"
}
16 changes: 13 additions & 3 deletions Correspondance/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Étape 1: Charger les fichiers
df_etablissement = pd.read_excel("Liste_Etablissements.xlsx")
df_dsi = pd.read_excel("count_dsi_trier.xlsx")
df_dsi = pd.read_excel("count_dsi_trier_V2.xlsx")

# Création d'un dictionnaire pour faciliter la recherche
dict_etablissement = df_etablissement.set_index('Code Regate').to_dict(orient='index')
Expand All @@ -19,10 +19,20 @@ def apply_logic(code):
if code in dict_etablissement:
site_traitement = dict_etablissement[code]["Site traitement Oui/Non"]
ouvert_status = dict_etablissement[code]["Ouvert Oui/Non"]
return "Non Traitement" if site_traitement == "Non" else "Correspondance", "Ouvert" if ouvert_status == "Oui" else "Fermé"

# Détermine le résultat en fonction de site_traitement
if site_traitement == "Oui":
result = "Correspondance / Traitement"
elif site_traitement == "Non":
result = "Non Traitement"
else:
result = "Correspondance"

ouvert = "Ouvert" if ouvert_status == "Oui" else "Fermé"
return result, ouvert
return "Non correspondance", ""

df_dsi[result_col_name], df_dsi[ouvert_col_name] = zip(*df_dsi[col].map(apply_logic))

# Étape 6: Sauvegarder les modifications dans le même fichier
df_dsi.to_excel("count_dsi_trier_V2.xlsx", index=False)
df_dsi.to_excel("count_dsi_trier_V2_test.xlsx", index=False)

0 comments on commit 8caaab5

Please sign in to comment.