From 67f7a72a023a54114ec4296ce014dbb8b26d279f Mon Sep 17 00:00:00 2001 From: Alejandro Rosales Date: Thu, 5 Sep 2024 19:13:31 +0000 Subject: [PATCH] Evitar decimales --- app.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app.py b/app.py index 76a6971..97f5562 100644 --- a/app.py +++ b/app.py @@ -114,6 +114,9 @@ def extract(username: str, password: str): if 'GRUPO' not in df.columns: raise KeyError("Column 'GRUPO' not found in the DataFrame") + # Remove decimals from the 'PERIODO' column (if present) + df['PERIODO'] = df['PERIODO'].apply(lambda x: str(x).replace('.0', '') if isinstance(x, (float, int)) else x) + # Convert the DataFrame to JSON json_result = df[df['GRUPO'] != 'Promedio:'].to_json(orient='records')