edb-noumea 0.2.11__tar.gz → 0.2.12__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {edb_noumea-0.2.11 → edb_noumea-0.2.12}/PKG-INFO +1 -1
- {edb_noumea-0.2.11 → edb_noumea-0.2.12}/edb_noumea/details.py +30 -13
- {edb_noumea-0.2.11 → edb_noumea-0.2.12}/edb_noumea.egg-info/PKG-INFO +1 -1
- {edb_noumea-0.2.11 → edb_noumea-0.2.12}/pyproject.toml +1 -1
- {edb_noumea-0.2.11 → edb_noumea-0.2.12}/README.md +0 -0
- {edb_noumea-0.2.11 → edb_noumea-0.2.12}/edb_noumea/__init__.py +0 -0
- {edb_noumea-0.2.11 → edb_noumea-0.2.12}/edb_noumea/main.py +0 -0
- {edb_noumea-0.2.11 → edb_noumea-0.2.12}/edb_noumea.egg-info/SOURCES.txt +0 -0
- {edb_noumea-0.2.11 → edb_noumea-0.2.12}/edb_noumea.egg-info/dependency_links.txt +0 -0
- {edb_noumea-0.2.11 → edb_noumea-0.2.12}/edb_noumea.egg-info/requires.txt +0 -0
- {edb_noumea-0.2.11 → edb_noumea-0.2.12}/edb_noumea.egg-info/top_level.txt +0 -0
- {edb_noumea-0.2.11 → edb_noumea-0.2.12}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: edb-noumea
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.12
|
|
4
4
|
Summary: Un scraper pour la qualité des eaux de baignade à Nouméa.
|
|
5
5
|
Project-URL: Homepage, https://github.com/adriens/edb-noumea
|
|
6
6
|
Project-URL: Repository, https://github.com/adriens/edb-noumea
|
|
@@ -96,8 +96,19 @@ def get_detailed_results():
|
|
|
96
96
|
print("\nColonnes:", list(df.columns))
|
|
97
97
|
print("Shape:", df.shape)
|
|
98
98
|
|
|
99
|
-
#
|
|
100
|
-
|
|
99
|
+
# Sélection dynamique des colonnes bactéries par nom
|
|
100
|
+
# Recherche des colonnes contenant les mots-clés
|
|
101
|
+
e_coli_col = next((col for col in df.columns if "Escherichia" in str(col) or "coli" in str(col)), None)
|
|
102
|
+
entero_col = next((col for col in df.columns if "Entérocoques" in str(col)), None)
|
|
103
|
+
|
|
104
|
+
if e_coli_col is None or entero_col is None:
|
|
105
|
+
print(f"❌ Colonnes bactéries non trouvées dans le tableau extrait. Colonnes disponibles : {list(df.columns)}")
|
|
106
|
+
return None
|
|
107
|
+
|
|
108
|
+
# Sélectionne les 4 premières colonnes + colonnes bactéries trouvées
|
|
109
|
+
selected_cols = [df.columns[0], df.columns[1], df.columns[2], df.columns[4], e_coli_col, entero_col]
|
|
110
|
+
cleaned_df = df.loc[:, selected_cols].copy()
|
|
111
|
+
cleaned_df.columns = [
|
|
101
112
|
"site",
|
|
102
113
|
"point_de_prelevement",
|
|
103
114
|
"date",
|
|
@@ -105,8 +116,6 @@ def get_detailed_results():
|
|
|
105
116
|
"e_coli_npp_100ml",
|
|
106
117
|
"enterocoques_npp_100ml"
|
|
107
118
|
]
|
|
108
|
-
cleaned_df = df.iloc[:, :6].copy()
|
|
109
|
-
cleaned_df.columns = expected_columns
|
|
110
119
|
|
|
111
120
|
# Ajoute deux colonnes issues du split de 'point_de_prelevement'
|
|
112
121
|
split_points = cleaned_df["point_de_prelevement"].str.split(",", n=1, expand=True)
|
|
@@ -118,10 +127,15 @@ def get_detailed_results():
|
|
|
118
127
|
cleaned_df["heure"] = cleaned_df["heure"].astype(str)
|
|
119
128
|
|
|
120
129
|
# Nettoyer et convertir les colonnes e_coli_npp_100ml et enterocoques_npp_100ml
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
130
|
+
# Appliquer la même technique à l'avant-dernière colonne (e_coli_npp_100ml)
|
|
131
|
+
if "e_coli_npp_100ml" in cleaned_df.columns:
|
|
132
|
+
cleaned_df["e_coli_npp_100ml"] = cleaned_df["e_coli_npp_100ml"].astype(str).str.replace(r"<\s*10", "10", regex=True)
|
|
133
|
+
cleaned_df["e_coli_npp_100ml"] = pd.to_numeric(cleaned_df["e_coli_npp_100ml"], errors="coerce").astype('Int64')
|
|
134
|
+
|
|
135
|
+
# Appliquer la même technique à la dernière colonne (enterocoques_npp_100ml)
|
|
136
|
+
if "enterocoques_npp_100ml" in cleaned_df.columns:
|
|
137
|
+
cleaned_df["enterocoques_npp_100ml"] = cleaned_df["enterocoques_npp_100ml"].astype(str).str.replace(r"<\s*10", "10", regex=True)
|
|
138
|
+
cleaned_df["enterocoques_npp_100ml"] = pd.to_numeric(cleaned_df["enterocoques_npp_100ml"], errors="coerce").astype('Int64')
|
|
125
139
|
|
|
126
140
|
return cleaned_df
|
|
127
141
|
|
|
@@ -129,9 +143,12 @@ if __name__ == "__main__":
|
|
|
129
143
|
# Obtenir le DataFrame des résultats détaillés
|
|
130
144
|
detailed_df = get_detailed_results()
|
|
131
145
|
|
|
132
|
-
# Afficher
|
|
146
|
+
# Afficher seulement les colonnes demandées
|
|
133
147
|
if detailed_df is not None:
|
|
134
|
-
print("\n📋
|
|
135
|
-
print(detailed_df
|
|
136
|
-
|
|
137
|
-
|
|
148
|
+
print("\n📋 Détails synthétiques :")
|
|
149
|
+
print(detailed_df[[
|
|
150
|
+
"point_de_prelevement",
|
|
151
|
+
"date",
|
|
152
|
+
"e_coli_npp_100ml",
|
|
153
|
+
"enterocoques_npp_100ml"
|
|
154
|
+
]])
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: edb-noumea
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.12
|
|
4
4
|
Summary: Un scraper pour la qualité des eaux de baignade à Nouméa.
|
|
5
5
|
Project-URL: Homepage, https://github.com/adriens/edb-noumea
|
|
6
6
|
Project-URL: Repository, https://github.com/adriens/edb-noumea
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|