Evitar decimales
This commit is contained in:
3
app.py
3
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')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user