Gumball2k5 commited on
Commit
b68a34d
·
verified ·
1 Parent(s): b0193aa

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +14 -2
src/streamlit_app.py CHANGED
@@ -140,11 +140,23 @@ if run_copod:
140
  if st.session_state.df is None:
141
  st.warning("Upload data first.")
142
  else:
143
- df = st.session_state.df
 
 
 
 
 
 
 
 
 
 
 
144
  X = df.select_dtypes(include=[np.number])
145
 
146
  if X.shape[1] == 0:
147
- st.error("Dataset has no numeric columns.")
 
148
  else:
149
  # PLACEHOLDER SCORES
150
  scores = np.random.rand(len(X)) * 10
 
140
  if st.session_state.df is None:
141
  st.warning("Upload data first.")
142
  else:
143
+ df = st.session_state.df.copy()
144
+
145
+ for col in df.columns:
146
+ if df[col].dtype == 'object':
147
+ try:
148
+ df[col] = pd.to_numeric(df[col], errors='coerce')
149
+ except:
150
+ pass
151
+
152
+ df = df.dropna(axis=1, how='all')
153
+ df = df.fillna(0)
154
+
155
  X = df.select_dtypes(include=[np.number])
156
 
157
  if X.shape[1] == 0:
158
+ st.error("Dataset has no numeric columns. Please check your CSV format.")
159
+ st.write("Current Data Types:", df.dtypes)
160
  else:
161
  # PLACEHOLDER SCORES
162
  scores = np.random.rand(len(X)) * 10