Update app.py
Browse files
app.py
CHANGED
|
@@ -249,7 +249,7 @@ def process_dataframe(df):
|
|
| 249 |
df_class = df[required_columns_2].fillna("NA").copy()
|
| 250 |
|
| 251 |
# Transform categorical columns for prediction DataFrame using the label encoders.
|
| 252 |
-
for col in ['Tag', 'EngShp', 'EngQua', 'EngCol', 'EngCut', 'EngPol', 'EngSym', 'EngFlo', 'EngNts', 'EngMikly']:
|
| 253 |
try:
|
| 254 |
df_pred[col] = loaded_label_encoder[col].transform(df_pred[col])
|
| 255 |
except ValueError as e:
|
|
@@ -261,12 +261,12 @@ def process_dataframe(df):
|
|
| 261 |
df_class[col] = df_pred[col]
|
| 262 |
|
| 263 |
# Transform the extra columns in the classification DataFrame.
|
| 264 |
-
for col in ['EngBlk', 'EngWht', 'EngOpen', 'EngPav']:
|
| 265 |
-
|
| 266 |
-
|
| 267 |
-
|
| 268 |
-
|
| 269 |
-
|
| 270 |
|
| 271 |
# Convert both DataFrames to float.
|
| 272 |
df_pred = df_pred.astype(float)
|
|
|
|
| 249 |
df_class = df[required_columns_2].fillna("NA").copy()
|
| 250 |
|
| 251 |
# Transform categorical columns for prediction DataFrame using the label encoders.
|
| 252 |
+
for col in ['Tag', 'EngShp', 'EngQua', 'EngCol', 'EngCut', 'EngPol', 'EngSym', 'EngFlo', 'EngNts', 'EngMikly','EngBlk', 'EngWht', 'EngOpen', 'EngPav']:
|
| 253 |
try:
|
| 254 |
df_pred[col] = loaded_label_encoder[col].transform(df_pred[col])
|
| 255 |
except ValueError as e:
|
|
|
|
| 261 |
df_class[col] = df_pred[col]
|
| 262 |
|
| 263 |
# Transform the extra columns in the classification DataFrame.
|
| 264 |
+
#for col in ['EngBlk', 'EngWht', 'EngOpen', 'EngPav']:
|
| 265 |
+
# try:
|
| 266 |
+
# df_class[col] = loaded_label_encoder[col].transform(df_class[col])
|
| 267 |
+
# except ValueError as e:
|
| 268 |
+
# print(f'Invalid value in column {col}: {e}', 'error')
|
| 269 |
+
# return pd.DataFrame(), pd.DataFrame()
|
| 270 |
|
| 271 |
# Convert both DataFrames to float.
|
| 272 |
df_pred = df_pred.astype(float)
|