GMARTINEZMILLA commited on
Commit
ff69c07
1 Parent(s): e65d289

feat: updated website

Browse files
Files changed (1) hide show
  1. app.py +40 -29
app.py CHANGED
@@ -353,7 +353,6 @@ elif page == "Customer Analysis":
353
 
354
  # Column 1: Radar chart for top manufacturers
355
  with col1:
356
- # Overperforming manufacturers alert
357
  st.subheader("This looks great!")
358
  st.info("Your customer did exceed predicted sales from the following brands:")
359
 
@@ -370,21 +369,26 @@ elif page == "Customer Analysis":
370
  # Limit to top 10 overperforming manufacturers
371
  top_overperformers = overperforming_manufacturers.head(10)
372
 
373
- for index, row in top_overperformers.iterrows():
374
- manufacturer_name = get_supplier_name_encoded(row['marca_id_encoded'])
375
- predicted = row['ventas_predichas']
376
- actual = row['ventas_reales']
377
- extra = row['extra_amount']
378
-
379
- # Use Streamlit's st.metric for better styling
380
- st.metric(
381
- label=f"{manufacturer_name}",
382
- value=f"{actual:.2f}€",
383
- delta=f"Exceeded by {extra:.2f}€",
384
- delta_color="normal"
385
- )
386
- else:
387
- st.info("No manufacturers exceeded predicted sales.")
 
 
 
 
 
388
 
389
 
390
  # Radar chart logic remains the same
@@ -447,19 +451,26 @@ elif page == "Customer Analysis":
447
  # Limit to top 10 missed amounts
448
  top_misses = underperforming_manufacturers.head(10)
449
 
450
- for index, row in top_misses.iterrows():
451
- manufacturer_name = get_supplier_name_encoded(row['marca_id_encoded'])
452
- predicted = row['ventas_predichas']
453
- actual = row['ventas_reales']
454
- missed = row['missed_amount']
455
-
456
- # Use Streamlit's st.metric for better styling
457
- st.metric(
458
- label=f"{manufacturer_name}",
459
- value=f"{actual:.2f}€",
460
- delta=f"Missed by {missed:.2f}€",
461
- delta_color="inverse"
462
- )
 
 
 
 
 
 
 
463
  else:
464
  st.success("All manufacturers have met or exceeded predicted sales.")
465
 
 
353
 
354
  # Column 1: Radar chart for top manufacturers
355
  with col1:
 
356
  st.subheader("This looks great!")
357
  st.info("Your customer did exceed predicted sales from the following brands:")
358
 
 
369
  # Limit to top 10 overperforming manufacturers
370
  top_overperformers = overperforming_manufacturers.head(10)
371
 
372
+ # Display two cards per row
373
+ for i in range(0, len(top_overperformers), 2):
374
+ cols = st.columns(2) # Create two columns for two cards in a row
375
+
376
+ for j, col in enumerate(cols):
377
+ if i + j < len(top_overperformers):
378
+ row = top_overperformers.iloc[i + j]
379
+ manufacturer_name = get_supplier_name_encoded(row['marca_id_encoded'])
380
+ predicted = row['ventas_predichas']
381
+ actual = row['ventas_reales']
382
+ extra = row['extra_amount']
383
+
384
+ # Use st.metric for compact display in each column
385
+ with col:
386
+ st.metric(
387
+ label=f"{manufacturer_name}",
388
+ value=f"{actual:.2f}€",
389
+ delta=f"Exceeded by {extra:.2f}€",
390
+ delta_color="normal"
391
+ )
392
 
393
 
394
  # Radar chart logic remains the same
 
451
  # Limit to top 10 missed amounts
452
  top_misses = underperforming_manufacturers.head(10)
453
 
454
+ # Display two cards per row
455
+ for i in range(0, len(top_misses), 2):
456
+ cols = st.columns(2) # Create two columns for two cards in a row
457
+
458
+ for j, col in enumerate(cols):
459
+ if i + j < len(top_misses):
460
+ row = top_misses.iloc[i + j]
461
+ manufacturer_name = get_supplier_name_encoded(row['marca_id_encoded'])
462
+ predicted = row['ventas_predichas']
463
+ actual = row['ventas_reales']
464
+ missed = row['missed_amount']
465
+
466
+ # Use st.metric for compact display in each column
467
+ with col:
468
+ st.metric(
469
+ label=f"{manufacturer_name}",
470
+ value=f"{actual:.2f}€",
471
+ delta=f"Missed by {missed:.2f}€",
472
+ delta_color="inverse"
473
+ )
474
  else:
475
  st.success("All manufacturers have met or exceeded predicted sales.")
476