AMKhakbaz commited on
Commit
93c7fa7
·
verified ·
1 Parent(s): a07084d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -65,6 +65,8 @@ def multi_answer(df):
65
  friquency[str(unique_values)] = df[i].value_counts().get(unique_values, 0)
66
  except Exception as e:
67
  st.error(f"Warning: One of the data columns has no value.: {e}")
 
 
68
 
69
  friquency_dataframe = pd.DataFrame({"Value": friquency.keys(), "Friquency": friquency.values(), "Percentage": np.array(list(friquency.values()))/len(df.dropna(how='all'))*100}).sort_values(by='Value')
70
  friquency_dataframe.loc[len(friquency_dataframe)] = ['Sample_size', len(df.dropna(how='all')), 1]
@@ -275,7 +277,7 @@ if main_option == "Tabulation":
275
  st.subheader("Frequency Table")
276
  st.dataframe(frequency_df)
277
 
278
- fig = figo('Heatmap', percentile_df[:-1,:-1], title='Percentage Histogram', xlabel=var1, ylabel=var2, colorscale='Plotly3')
279
  st.plotly_chart(fig, use_container_width=True)
280
 
281
  elif type1 == "Single answer" and type2 == "Multiple answer":
@@ -288,7 +290,7 @@ if main_option == "Tabulation":
288
  st.subheader("Frequency Table")
289
  st.dataframe(frequency_df)
290
 
291
- fig = figo('Heatmap', percentile_df[:-1,:-1], title='Percentage Histogram', xlabel=var1, ylabel=var2, colorscale='Plotly3')
292
  st.plotly_chart(fig, use_container_width=True)
293
 
294
  else:
 
65
  friquency[str(unique_values)] = df[i].value_counts().get(unique_values, 0)
66
  except Exception as e:
67
  st.error(f"Warning: One of the data columns has no value.: {e}")
68
+ friquency[i] = 0
69
+
70
 
71
  friquency_dataframe = pd.DataFrame({"Value": friquency.keys(), "Friquency": friquency.values(), "Percentage": np.array(list(friquency.values()))/len(df.dropna(how='all'))*100}).sort_values(by='Value')
72
  friquency_dataframe.loc[len(friquency_dataframe)] = ['Sample_size', len(df.dropna(how='all')), 1]
 
277
  st.subheader("Frequency Table")
278
  st.dataframe(frequency_df)
279
 
280
+ fig = figo('Heatmap', percentile_df.iloc[:-1,:-1], title='Percentage Histogram', xlabel=var1, ylabel=var2, colorscale='Plotly3')
281
  st.plotly_chart(fig, use_container_width=True)
282
 
283
  elif type1 == "Single answer" and type2 == "Multiple answer":
 
290
  st.subheader("Frequency Table")
291
  st.dataframe(frequency_df)
292
 
293
+ fig = figo('Heatmap', percentile_df.iloc[:-1,:-1], title='Percentage Histogram', xlabel=var1, ylabel=var2, colorscale='Plotly3')
294
  st.plotly_chart(fig, use_container_width=True)
295
 
296
  else: