GMARTINEZMILLA commited on
Commit
6c1c89e
1 Parent(s): ef1d523

feat: updated app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -0
app.py CHANGED
@@ -303,9 +303,17 @@ elif page == "Customer Analysis":
303
 
304
  # Prepare data for prediction
305
  X_predict = customer_data[features]
 
 
 
 
 
 
306
  st.write("### Features for Prediction:")
307
  st.write(X_predict.head())
308
  st.write(f"Shape: {X_predict.shape}")
 
 
309
 
310
  # Make Prediction for the selected customer
311
  y_pred = gbm.predict(X_predict, num_iteration=gbm.best_iteration)
 
303
 
304
  # Prepare data for prediction
305
  X_predict = customer_data[features]
306
+
307
+ # Convert categorical features to 'category' dtype
308
+ categorical_features = ['mes', 'marca_id_encoded', 'cluster_id']
309
+ for feature in categorical_features:
310
+ X_predict[feature] = X_predict[feature].astype('category')
311
+
312
  st.write("### Features for Prediction:")
313
  st.write(X_predict.head())
314
  st.write(f"Shape: {X_predict.shape}")
315
+ st.write("Data types:")
316
+ st.write(X_predict.dtypes)
317
 
318
  # Make Prediction for the selected customer
319
  y_pred = gbm.predict(X_predict, num_iteration=gbm.best_iteration)