Spaces:
Runtime error

JoyB commited on
Commit
02443ac
·
verified ·
1 Parent(s): 2e98fba

Changed % charts to Pie chart view

Browse files
Files changed (1) hide show
  1. app.py +16 -5
app.py CHANGED
@@ -120,15 +120,26 @@ def analyze_dataframe(df, max_unique_for_categorical=20):
120
  )
121
  st.plotly_chart(fig_count, use_container_width=True)
122
 
 
 
 
 
 
 
 
 
 
 
123
  with col2:
124
- # Bar chart of percentages
125
- fig_percent = px.bar(
126
- x=value_percentages.index,
127
- y=value_percentages.values,
128
  title=f"Percentage Distribution of {col_name}",
129
- labels={'x': col_name, 'y': 'Percentage (%)'}
130
  )
131
  st.plotly_chart(fig_percent, use_container_width=True)
 
132
 
133
  # Display frequency table
134
  freq_df = pd.DataFrame({
 
120
  )
121
  st.plotly_chart(fig_count, use_container_width=True)
122
 
123
+ # with col2:
124
+ # # Bar chart of percentages
125
+ # fig_percent = px.bar(
126
+ # x=value_percentages.index,
127
+ # y=value_percentages.values,
128
+ # title=f"Percentage Distribution of {col_name}",
129
+ # labels={'x': col_name, 'y': 'Percentage (%)'}
130
+ # )
131
+ # st.plotly_chart(fig_percent, use_container_width=True)
132
+
133
  with col2:
134
+ # Pie chart of percentages
135
+ fig_percent = px.pie(
136
+ names=value_percentages.index,
137
+ values=value_percentages.values,
138
  title=f"Percentage Distribution of {col_name}",
139
+ hole=0.3 # Optional: to make it a donut chart
140
  )
141
  st.plotly_chart(fig_percent, use_container_width=True)
142
+
143
 
144
  # Display frequency table
145
  freq_df = pd.DataFrame({