From 59b92549dca7211f139dcd49dc41e5489fdc0d1a Mon Sep 17 00:00:00 2001 From: Alejandro Rosales Date: Mon, 5 Aug 2024 11:12:36 -0600 Subject: [PATCH] Verificar grupo Verificar campo de grupo ['GRUPO'] --- app.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app.py b/app.py index 718f881..a5706ec 100644 --- a/app.py +++ b/app.py @@ -109,6 +109,9 @@ def extract(username: str, password: str): historial_html_io = StringIO(f"{historial_html}
") # Read the HTML table into a DataFrame df = pd.read_html(historial_html_io)[0] + + if 'GRUPO' not in df.columns: + raise KeyError("Column 'GRUPO' not found in the DataFrame") # Convert the DataFrame to JSON json_result = df[df['GRUPO'] != 'Promedio:'].to_json(orient='records')