GMARTINEZMILLA commited on
Commit
7b48ff1
·
1 Parent(s): 84f39ab

feat: generate the filtering by manufacturer not complete

Browse files
Files changed (1) hide show
  1. app.py +28 -18
app.py CHANGED
@@ -309,6 +309,14 @@ elif page == "🕵️ Análisis de Cliente":
309
  help="Start typing to search for a specific customer code"
310
  )
311
 
 
 
 
 
 
 
 
 
312
  if st.button("Calcular"):
313
  if customer_code:
314
  with st.spinner("Estamos identificando el grupo del cliente..."):
@@ -636,24 +644,7 @@ elif page == "🕵️ Análisis de Cliente":
636
  else:
637
  st.success("All manufacturers have met or exceeded predicted sales.")
638
 
639
- # # Gráfico adicional: Comparar las ventas predichas y reales para los principales fabricantes
640
- # st.markdown("### Predicted vs Actual Sales for Top Manufacturers")
641
- # top_manufacturers = results.groupby('marca_id_encoded').agg({'ventas_reales': 'sum', 'ventas_predichas': 'sum'}).sort_values(by='ventas_reales', ascending=False).head(10)
642
-
643
- # fig_comparison = go.Figure()
644
- # fig_comparison.add_trace(go.Bar(x=top_manufacturers.index, y=top_manufacturers['ventas_reales'], name="Actual Sales", marker_color='blue'))
645
- # fig_comparison.add_trace(go.Bar(x=top_manufacturers.index, y=top_manufacturers['ventas_predichas'], name="Predicted Sales", marker_color='orange'))
646
-
647
- # fig_comparison.update_layout(
648
- # title="Actual vs Predicted Sales by Top Manufacturers",
649
- # xaxis_title="Manufacturer",
650
- # yaxis_title="Sales (€)",
651
- # barmode='group',
652
- # height=400,
653
- # hovermode="x unified"
654
- # )
655
 
656
- # st.plotly_chart(fig_comparison, use_container_width=True)
657
 
658
  # Gráfico de ventas anuales
659
  ventas_clientes['codigo_cliente'] = ventas_clientes['codigo_cliente'].astype(str).str.strip()
@@ -867,4 +858,23 @@ elif page == "💡 Recomendación de Artículos":
867
  # else:
868
  # st.warning("⚠️ No recommendations found for the provided basket.")
869
  # else:
870
- # st.warning("⚠️ Please select at least one article and set its quantity.")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
309
  help="Start typing to search for a specific customer code"
310
  )
311
 
312
+ # Fabricante dropdown (with 'Todos' option)
313
+ fabricantes = ["Todos"] + list(nombres_proveedores['nombre_proveedor'].unique()) # Agregar la opción 'Todos'
314
+ fabricante_seleccionado = st.selectbox(
315
+ "Selecciona el fabricante (o Todos)",
316
+ fabricantes,
317
+ help="Selecciona un fabricante específico o 'Todos' para ver todos los fabricantes"
318
+ )
319
+
320
  if st.button("Calcular"):
321
  if customer_code:
322
  with st.spinner("Estamos identificando el grupo del cliente..."):
 
644
  else:
645
  st.success("All manufacturers have met or exceeded predicted sales.")
646
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
647
 
 
648
 
649
  # Gráfico de ventas anuales
650
  ventas_clientes['codigo_cliente'] = ventas_clientes['codigo_cliente'].astype(str).str.strip()
 
858
  # else:
859
  # st.warning("⚠️ No recommendations found for the provided basket.")
860
  # else:
861
+ # st.warning("⚠️ Please select at least one article and set its quantity.")
862
+
863
+ # # Gráfico adicional: Comparar las ventas predichas y reales para los principales fabricantes
864
+ # st.markdown("### Predicted vs Actual Sales for Top Manufacturers")
865
+ # top_manufacturers = results.groupby('marca_id_encoded').agg({'ventas_reales': 'sum', 'ventas_predichas': 'sum'}).sort_values(by='ventas_reales', ascending=False).head(10)
866
+
867
+ # fig_comparison = go.Figure()
868
+ # fig_comparison.add_trace(go.Bar(x=top_manufacturers.index, y=top_manufacturers['ventas_reales'], name="Actual Sales", marker_color='blue'))
869
+ # fig_comparison.add_trace(go.Bar(x=top_manufacturers.index, y=top_manufacturers['ventas_predichas'], name="Predicted Sales", marker_color='orange'))
870
+
871
+ # fig_comparison.update_layout(
872
+ # title="Actual vs Predicted Sales by Top Manufacturers",
873
+ # xaxis_title="Manufacturer",
874
+ # yaxis_title="Sales (€)",
875
+ # barmode='group',
876
+ # height=400,
877
+ # hovermode="x unified"
878
+ # )
879
+
880
+ # st.plotly_chart(fig_comparison, use_container_width=True)