ProtonDataLabs commited on
Commit
a2ed34a
1 Parent(s): a0eb668

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -16
app.py CHANGED
@@ -101,7 +101,7 @@ def load_data(active_card):
101
  st.image("bonnie.png", width=150) # Adjust width as needed
102
 
103
  # Display title
104
- st.title("Price vs. Sales Volume Tracker Dashboard")
105
 
106
 
107
  # Initialize session state for storing which card was clicked and item type
@@ -116,7 +116,7 @@ if 'selected_feature' not in st.session_state:
116
  # Card selection buttons with logic to reset session state on switch
117
  col1, col2, col3 = st.columns(3)
118
  with col1:
119
- if st.button("Sales Volume Trend for Item Category"):
120
  st.session_state['active_card'] = 'card1'
121
  # Reset other selections when switching cards
122
  st.session_state['selected_state'] = None
@@ -125,7 +125,7 @@ with col1:
125
  st.session_state['selected_containercode'] = None
126
 
127
  with col2:
128
- if st.button("Sales Volume & Unit Price Correlation for Item Category and Container Code"):
129
  st.session_state['active_card'] = 'card2'
130
  # Reset selections when switching cards
131
  st.session_state['selected_state'] = None
@@ -134,7 +134,7 @@ with col2:
134
  st.session_state['selected_containercode'] = None
135
 
136
  with col3:
137
- if st.button("PE Coefficient Calculation for Regions & Item Categories"):
138
  st.session_state['active_card'] = 'card3'
139
  # Reset selections when switching cards
140
  st.session_state['selected_state'] = None
@@ -306,18 +306,25 @@ if st.session_state['active_card'] == 'card1':
306
  top_stores = df[(df['State'] == selected_state) & (df['Chaincode'] == selected_chaincode) & (df['Itemtype'] == selected_itemtype)].groupby('Store', observed=True)['SalesVolume'].sum().nlargest(3).reset_index()
307
  bottom_stores = df[(df['State'] == selected_state) & (df['Chaincode'] == selected_chaincode) & (df['Itemtype'] == selected_itemtype)].groupby('Store', observed=True)['SalesVolume'].sum().nsmallest(3).reset_index()
308
 
309
- # Create a table with the top and bottom container codes and stores
310
- st.write("### Top 3 Container Codes:")
311
- st.dataframe(top_containercodes)
312
-
313
- st.write("### Bottom 3 Container Codes:")
314
- st.dataframe(bottom_containercodes)
315
-
316
- st.write("### Top 3 Stores:")
317
- st.dataframe(top_stores)
318
-
319
- st.write("### Bottom 3 Stores:")
320
- st.dataframe(bottom_stores)
 
 
 
 
 
 
 
321
  ##########################################################################################################
322
 
323
 
 
101
  st.image("bonnie.png", width=150) # Adjust width as needed
102
 
103
  # Display title
104
+ # st.title("Price vs. Sales Volume Tracker Dashboard")
105
 
106
 
107
  # Initialize session state for storing which card was clicked and item type
 
116
  # Card selection buttons with logic to reset session state on switch
117
  col1, col2, col3 = st.columns(3)
118
  with col1:
119
+ if st.button("Sales Volume Trend"):
120
  st.session_state['active_card'] = 'card1'
121
  # Reset other selections when switching cards
122
  st.session_state['selected_state'] = None
 
125
  st.session_state['selected_containercode'] = None
126
 
127
  with col2:
128
+ if st.button("Sales Volume vs Median Unit Price Trend"):
129
  st.session_state['active_card'] = 'card2'
130
  # Reset selections when switching cards
131
  st.session_state['selected_state'] = None
 
134
  st.session_state['selected_containercode'] = None
135
 
136
  with col3:
137
+ if st.button("Price Elasticity Coefficient Trend YoY"):
138
  st.session_state['active_card'] = 'card3'
139
  # Reset selections when switching cards
140
  st.session_state['selected_state'] = None
 
306
  top_stores = df[(df['State'] == selected_state) & (df['Chaincode'] == selected_chaincode) & (df['Itemtype'] == selected_itemtype)].groupby('Store', observed=True)['SalesVolume'].sum().nlargest(3).reset_index()
307
  bottom_stores = df[(df['State'] == selected_state) & (df['Chaincode'] == selected_chaincode) & (df['Itemtype'] == selected_itemtype)].groupby('Store', observed=True)['SalesVolume'].sum().nsmallest(3).reset_index()
308
 
309
+ # Display top and bottom container codes side by side
310
+ st.write("### Container Codes:")
311
+ col1, col2 = st.columns(2)
312
+ with col1:
313
+ st.write("#### Top 3 Container Codes")
314
+ st.dataframe(top_containercodes)
315
+ with col2:
316
+ st.write("#### Bottom 3 Container Codes")
317
+ st.dataframe(bottom_containercodes)
318
+
319
+ # Display top and bottom stores side by side
320
+ st.write("### Stores:")
321
+ col3, col4 = st.columns(2)
322
+ with col3:
323
+ st.write("#### Top 3 Stores")
324
+ st.dataframe(top_stores)
325
+ with col4:
326
+ st.write("#### Bottom 3 Stores")
327
+ st.dataframe(bottom_stores)
328
  ##########################################################################################################
329
 
330