Validación de grupo
This commit is contained in:
6
app.py
6
app.py
@@ -155,13 +155,13 @@ def extract(driver, username: str, password: str):
|
|||||||
historial_html_io = StringIO(f"<table>{historial_html}</table>")
|
historial_html_io = StringIO(f"<table>{historial_html}</table>")
|
||||||
df = pd.read_html(historial_html_io)[0]
|
df = pd.read_html(historial_html_io)[0]
|
||||||
|
|
||||||
if 'GRUPO' not in df.columns:
|
json_result = []
|
||||||
raise KeyError("Column 'GRUPO' not found in the DataFrame")
|
|
||||||
|
|
||||||
|
if 'GRUPO' in df.columns:
|
||||||
df['PERIODO'] = df['PERIODO'].apply(lambda x: str(x).replace('.0', '') if isinstance(x, (float, int)) else x)
|
df['PERIODO'] = df['PERIODO'].apply(lambda x: str(x).replace('.0', '') if isinstance(x, (float, int)) else x)
|
||||||
|
|
||||||
json_result = df[df['GRUPO'] != 'Promedio:'].to_json(orient='records')
|
json_result = df[df['GRUPO'] != 'Promedio:'].to_json(orient='records')
|
||||||
|
|
||||||
|
|
||||||
query = insert_alumno_extraccion(datos_html, materias_html, username_integer, json_result)
|
query = insert_alumno_extraccion(datos_html, materias_html, username_integer, json_result)
|
||||||
print("Data extracted successfully")
|
print("Data extracted successfully")
|
||||||
return json_result
|
return json_result
|
||||||
|
|||||||
Reference in New Issue
Block a user