Spaces:
Sleeping
Sleeping
File size: 2,473 Bytes
89e696a 36f3034 89e696a 36f3034 2c1bfb4 ab9c8b0 2c1bfb4 ab9c8b0 2c1bfb4 36f3034 ab9c8b0 36f3034 ab9c8b0 36f3034 ab9c8b0 36f3034 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
import streamlit as st
import pandas as pd
import plotly.express as px
# Configuración de la página principal
st.set_page_config(page_title="Customer Insights App", page_icon=":bar_chart:")
# Diseño de la página principal
st.title("Welcome to Customer Insights App")
st.markdown("""
This app helps businesses analyze customer behaviors and provide personalized recommendations based on purchase history.
Use the tools below to dive deeper into your customer data.
""")
# Menú de navegación
page = st.selectbox("Select a page", ["Home", "Customer Analysis", "Customer Recommendations"])
# Página Home
if page == "Home":
st.markdown("## Welcome to the Customer Insights App")
st.write("Use the dropdown menu to navigate between the different sections.")
# Página Customer Analysis
elif page == "Customer Analysis":
st.title("Customer Analysis")
st.markdown("""
Use the tools below to explore your customer data.
""")
# Cargar y visualizar datos
uploaded_file = st.file_uploader("Upload your CSV file", type="csv")
if uploaded_file:
df = pd.read_csv(uploaded_file)
st.write("## Dataset Overview", df.head())
# Mostrar un gráfico interactivo
st.markdown("### Sales per Customer")
customer_sales = df.groupby("CLIENTE")["VENTA_ANUAL"].sum().reset_index()
fig = px.bar(customer_sales, x="CLIENTE", y="VENTA_ANUAL", title="Annual Sales per Customer")
st.plotly_chart(fig)
# Página Customer Recommendations
elif page == "Customer Recommendations":
st.title("Customer Recommendations")
st.markdown("""
Get tailored recommendations for your customers based on their purchasing history.
""")
# Cargar los datos
uploaded_file = st.file_uploader("Upload your CSV file", type="csv")
if uploaded_file:
df = pd.read_csv(uploaded_file)
# Selección de cliente
customer_id = st.selectbox("Select a Customer", df["CLIENTE"].unique())
# Mostrar historial de compras del cliente seleccionado
st.write(f"### Purchase History for Customer {customer_id}")
customer_data = df[df["CLIENTE"] == customer_id]
st.write(customer_data)
# Generar recomendaciones (placeholder)
st.write(f"### Recommended Products for Customer {customer_id}")
# Aquí puedes reemplazar con tu lógica de recomendación de productos
st.write("Product A, Product B, Product C")
|