GMARTINEZMILLA commited on
Commit
f643712
1 Parent(s): f4c152d

feat: updated website

Browse files
Files changed (1) hide show
  1. app.py +15 -24
app.py CHANGED
@@ -199,31 +199,22 @@ if page == "Summary":
199
  with col2:
200
  st.markdown('#### 3D Customer Clusters')
201
 
202
- # Replace with your own customer cluster visualization
203
- np.random.seed(42)
204
- df_cluster = pd.DataFrame({
205
- 'Cluster': np.random.choice(['Cluster 1', 'Cluster 2', 'Cluster 3', 'Cluster 4'], 100),
206
- 'x': np.random.randn(100),
207
- 'y': np.random.randn(100),
208
- 'z': np.random.randn(100)
209
- })
210
- fig_cluster = px.scatter_3d(df_cluster, x='x', y='y', z='z', color='Cluster')
211
- fig_cluster.update_layout(
212
- scene=dict(aspectratio=dict(x=1, y=1, z=0.7)), # Control the aspect ratio
213
- margin=dict(t=0, b=0, l=0, r=0), # Tighten margins
214
- height=300, # Shrink the height to fit page better
215
  )
216
- st.plotly_chart(fig_cluster, use_container_width=True)
217
-
218
- st.markdown('#### Sales by Cluster')
219
-
220
- # Replace with your own sales data
221
- sales_data = {'Cluster': ['Cluster 1', 'Cluster 2', 'Cluster 3', 'Cluster 4'],
222
- 'Sales': [400000, 600000, 500000, 300000]}
223
- df_sales = pd.DataFrame(sales_data)
224
- fig_sales = px.bar(df_sales, x='Cluster', y='Sales')
225
- fig_sales.update_layout(paper_bgcolor=plot_bgcolor, plot_bgcolor=plot_bgcolor)
226
- st.plotly_chart(fig_sales, use_container_width=True)
227
 
228
  # Right Column (Blue): Key Metrics Overview and Data Preparation Summary
229
  with col3:
 
199
  with col2:
200
  st.markdown('#### 3D Customer Clusters')
201
 
202
+ # Create 3D PCA plot using actual data from pca_data_5
203
+ fig_cluster = px.scatter_3d(
204
+ pca_data_5,
205
+ x='PC1',
206
+ y='PC2',
207
+ z='PC3',
208
+ color='cluster_id',
209
+ hover_name='CustomerID',
210
+ title='3D PCA Customer Clusters'
 
 
 
 
211
  )
212
+ fig_cluster.update_layout(
213
+ scene=dict(aspectratio=dict(x=1, y=1, z=0.7)), # Control the aspect ratio
214
+ margin=dict(t=0, b=0, l=0, r=0), # Tighten margins
215
+ height=300, # Shrink the height to fit page better
216
+ )
217
+ st.plotly_chart(fig_cluster, use_container_width=True)
 
 
 
 
 
218
 
219
  # Right Column (Blue): Key Metrics Overview and Data Preparation Summary
220
  with col3: