edb-noumea 0.2.8__py3-none-any.whl → 0.2.10__py3-none-any.whl

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/details.py CHANGED
@@ -96,27 +96,17 @@ def get_detailed_results():
96
96
  print("\nColonnes:", list(df.columns))
97
97
  print("Shape:", df.shape)
98
98
 
99
- # Sélectionne et renomme les colonnes demandées
100
- columns_map = {
101
- 'Unnamed: 0': 'Nom du site de baignade',
102
- 'Unnamed: 1': 'Point de prélèvement',
103
- 'Unnamed: 2': 'Date du prélèvement',
104
- 'Unnamed: 3': 'Heure du prélèvement',
105
- 'Escherichia': 'Escherichia coli (NPP/100ml)',
106
- 'Entérocoques': 'Entérocoques intestinaux (NPP/100ml)'
107
- }
108
- cleaned_df = df[list(columns_map.keys())].rename(columns=columns_map)
109
- # Supprime la première ligne (ligne d'en-tête du PDF)
110
- cleaned_df = cleaned_df.iloc[1:].reset_index(drop=True)
111
- # Renomme les colonnes pour correspondre au style Python
112
- cleaned_df = cleaned_df.rename(columns={
113
- "Nom du site de baignade": "site",
114
- "Point de prélèvement": "point_de_prelevement",
115
- "Date du prélèvement": "date",
116
- "Heure du prélèvement": "heure",
117
- "Escherichia coli (NPP/100ml)": "e_coli_npp_100ml",
118
- "Entérocoques intestinaux (NPP/100ml)": "enterocoques_npp_100ml"
119
- })
99
+ # Sélectionne les colonnes par position et applique le mapping fixe
100
+ expected_columns = [
101
+ "site",
102
+ "point_de_prelevement",
103
+ "date",
104
+ "heure",
105
+ "e_coli_npp_100ml",
106
+ "enterocoques_npp_100ml"
107
+ ]
108
+ cleaned_df = df.iloc[:, :6].copy()
109
+ cleaned_df.columns = expected_columns
120
110
 
121
111
  # Ajoute deux colonnes issues du split de 'point_de_prelevement'
122
112
  split_points = cleaned_df["point_de_prelevement"].str.split(",", n=1, expand=True)
@@ -127,6 +117,12 @@ def get_detailed_results():
127
117
  if "heure" in cleaned_df.columns:
128
118
  cleaned_df["heure"] = cleaned_df["heure"].astype(str)
129
119
 
120
+ # Nettoyer et convertir les colonnes e_coli_npp_100ml et enterocoques_npp_100ml
121
+ for col in ["e_coli_npp_100ml", "enterocoques_npp_100ml"]:
122
+ if col in cleaned_df.columns:
123
+ cleaned_df[col] = cleaned_df[col].replace(r"<\s*10", "10", regex=True)
124
+ cleaned_df[col] = pd.to_numeric(cleaned_df[col], errors="coerce").astype('Int64')
125
+
130
126
  return cleaned_df
131
127
 
132
128
  if __name__ == "__main__":
@@ -138,4 +134,4 @@ if __name__ == "__main__":
138
134
  print("\n📋 Voici les détails des derniers relevés (toutes colonnes) :")
139
135
  print(detailed_df)
140
136
  print("\nColonnes du DataFrame :")
141
- #print(list(detailed_df.columns))
137
+ print(list(detailed_df.columns))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: edb-noumea
3
- Version: 0.2.8
3
+ Version: 0.2.10
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
@@ -0,0 +1,7 @@
1
+ edb_noumea/__init__.py,sha256=G7WKTGLsr2wtW1E2jYpqq4miZLoSGhTifSE36CGNkLo,60
2
+ edb_noumea/details.py,sha256=6mIFqB1bpt7bl9D3qhHGXE7uBL_oePgPuJf9dqbiQlE,5794
3
+ edb_noumea/main.py,sha256=KWT0ZGrHlbhEsQxi_Rw0Mm1syDIxoY-Px1yab94IbJc,2115
4
+ edb_noumea-0.2.10.dist-info/METADATA,sha256=RHWREnR-vbrA-5XdlUxd6XxWV9spwiJXZxR1ECfaYBE,396
5
+ edb_noumea-0.2.10.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
6
+ edb_noumea-0.2.10.dist-info/top_level.txt,sha256=Dj3JusM0b5H9_f9yZeO-IwucCZzI1OHSjLMKtvRjq6k,11
7
+ edb_noumea-0.2.10.dist-info/RECORD,,
@@ -1,7 +0,0 @@
1
- edb_noumea/__init__.py,sha256=G7WKTGLsr2wtW1E2jYpqq4miZLoSGhTifSE36CGNkLo,60
2
- edb_noumea/details.py,sha256=Tg51KP1IYLr9EHTjgd7ijtZMq9Y8riTRTQOdwgoiuJg,6123
3
- edb_noumea/main.py,sha256=KWT0ZGrHlbhEsQxi_Rw0Mm1syDIxoY-Px1yab94IbJc,2115
4
- edb_noumea-0.2.8.dist-info/METADATA,sha256=-S69a6Mim62mVy-LK1XtmODDzUxDa_Q5zYB35gljUOM,395
5
- edb_noumea-0.2.8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
6
- edb_noumea-0.2.8.dist-info/top_level.txt,sha256=Dj3JusM0b5H9_f9yZeO-IwucCZzI1OHSjLMKtvRjq6k,11
7
- edb_noumea-0.2.8.dist-info/RECORD,,