Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -231,8 +231,6 @@ def predict():
|
|
| 231 |
else:
|
| 232 |
df = pd.read_excel(filepath)
|
| 233 |
|
| 234 |
-
# Replace blank/missing cells with "-"
|
| 235 |
-
df.fillna("-", inplace=True)
|
| 236 |
except Exception as e:
|
| 237 |
print(f'Error reading file: {e}', 'error')
|
| 238 |
return redirect(url_for('index'))
|
|
@@ -391,7 +389,10 @@ def process_dataframe(df):
|
|
| 391 |
'''
|
| 392 |
|
| 393 |
# Final return with full data for pagination.
|
| 394 |
-
|
|
|
|
|
|
|
|
|
|
| 395 |
except Exception as e:
|
| 396 |
print(f'Error processing file: {e}', 'error')
|
| 397 |
return pd.DataFrame(), pd.DataFrame()
|
|
|
|
| 231 |
else:
|
| 232 |
df = pd.read_excel(filepath)
|
| 233 |
|
|
|
|
|
|
|
| 234 |
except Exception as e:
|
| 235 |
print(f'Error reading file: {e}', 'error')
|
| 236 |
return redirect(url_for('index'))
|
|
|
|
| 389 |
'''
|
| 390 |
|
| 391 |
# Final return with full data for pagination.
|
| 392 |
+
# Final step to replace NaN or empty values with "-"
|
| 393 |
+
df_pred = df_pred.fillna("-")
|
| 394 |
+
df_pred = df_pred.replace(r'^\s*$', "-", regex=True)
|
| 395 |
+
return df_pred, df_pred
|
| 396 |
except Exception as e:
|
| 397 |
print(f'Error processing file: {e}', 'error')
|
| 398 |
return pd.DataFrame(), pd.DataFrame()
|