Sasidhar commited on
Commit
7aaadbd
·
1 Parent(s): 064e382

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -3
app.py CHANGED
@@ -207,10 +207,16 @@ def create_for_bivariate_analysis(selected_files, df, i):
207
  bivariate_columns = st.multiselect("Select the columns to analyse ", df.columns.values,
208
  key= "bivariate_analysis_columns_" + str(i))
209
 
210
- for col in bivariate_columns:
 
 
 
 
211
  if viz_type == 'Cross Tab':
212
- st.subheader(f"{col} --> {target_column}")
213
- st.write(pd.crosstab(df[target_column], df[col], margins=True))
 
 
214
  # 3 any other aggregation function can be used based on column type
215
 
216
 
 
207
  bivariate_columns = st.multiselect("Select the columns to analyse ", df.columns.values,
208
  key= "bivariate_analysis_columns_" + str(i))
209
 
210
+ col_vals = []
211
+
212
+ if col_vals:
213
+ for col in bivariate_columns:
214
+ col_vals.append(df[col])
215
  if viz_type == 'Cross Tab':
216
+ if len(col_vals) > 3 :
217
+ st.warning("Too many columns to split on. Please consider reducing the no of columns")
218
+ crosstab_df = pd.crosstab(df[target_column], col_vals, margins=True)
219
+ st.write(crosstab_df.to_html(),unsafe_allow_html=True)
220
  # 3 any other aggregation function can be used based on column type
221
 
222