CosmickVisions commited on
Commit
3d81b42
·
verified ·
1 Parent(s): 9a92166

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -10
app.py CHANGED
@@ -17,6 +17,7 @@ import scipy.stats as stats
17
  import matplotlib.pyplot as plt #For SHAP charts
18
  from scipy.stats import pearsonr, spearmanr
19
  from sklearn.inspection import permutation_importance
 
20
  from sklearn.preprocessing import StandardScaler, LabelEncoder
21
  from sklearn.model_selection import train_test_split
22
  from sklearn.ensemble import RandomForestClassifier, RandomForestRegressor
@@ -516,14 +517,14 @@ elif app_mode == "Data Cleaning":
516
  if columns_to_drop:
517
  st.warning(f"Will drop: {', '.join(columns_to_drop)}")
518
  if st.button("Confirm Drop (Columns)"):
519
- new_df = df.copy()
520
- new_df = new_df.drop(columns=columns_to_drop)
521
- update_cleaned_data(new_df)
522
- st.rerun() #Force re-run after apply
 
 
 
523
 
524
- # --------------------------
525
- # Label Encoding
526
- # --------------------------
527
  # --------------------------
528
  # Label/One-Hot Encoding
529
  # --------------------------
@@ -550,8 +551,6 @@ elif app_mode == "Data Cleaning":
550
  except Exception as e:
551
  st.error(f"Error: {str(e)}")
552
 
553
-
554
-
555
  # --------------------------
556
  # StandardScaler
557
  # --------------------------
@@ -565,7 +564,7 @@ elif app_mode == "Data Cleaning":
565
  scaler = StandardScaler()
566
  new_df[scale_cols] = scaler.fit_transform(new_df[scale_cols])
567
  update_cleaned_data(new_df)
568
- st.rerun()#Force re-run after apply
569
  except Exception as e:
570
  st.error(f"Error: {str(e)}")
571
 
 
17
  import matplotlib.pyplot as plt #For SHAP charts
18
  from scipy.stats import pearsonr, spearmanr
19
  from sklearn.inspection import permutation_importance
20
+ from sklearn.feature_extraction.text import TfidfVectorizer
21
  from sklearn.preprocessing import StandardScaler, LabelEncoder
22
  from sklearn.model_selection import train_test_split
23
  from sklearn.ensemble import RandomForestClassifier, RandomForestRegressor
 
517
  if columns_to_drop:
518
  st.warning(f"Will drop: {', '.join(columns_to_drop)}")
519
  if st.button("Confirm Drop (Columns)"):
520
+ try:
521
+ new_df = df.copy()
522
+ new_df = new_df.drop(columns=columns_to_drop)
523
+ update_cleaned_data(new_df)
524
+ st.rerun() # Force re-run after apply
525
+ except Exception as e:
526
+ st.error(f"Error: {str(e)}")
527
 
 
 
 
528
  # --------------------------
529
  # Label/One-Hot Encoding
530
  # --------------------------
 
551
  except Exception as e:
552
  st.error(f"Error: {str(e)}")
553
 
 
 
554
  # --------------------------
555
  # StandardScaler
556
  # --------------------------
 
564
  scaler = StandardScaler()
565
  new_df[scale_cols] = scaler.fit_transform(new_df[scale_cols])
566
  update_cleaned_data(new_df)
567
+ st.rerun() # Force re-run after apply
568
  except Exception as e:
569
  st.error(f"Error: {str(e)}")
570