Spaces:
Sleeping
Sleeping
GMARTINEZMILLA
commited on
Commit
•
b42a154
1
Parent(s):
1bd8569
feat: Added about section underneath table in col 3
Browse files
app.py
CHANGED
@@ -75,10 +75,13 @@ with st.sidebar:
|
|
75 |
|
76 |
# Generamos la columna total_sales
|
77 |
ventas_clientes['total_sales'] = ventas_clientes[['VENTA_2021', 'VENTA_2022', 'VENTA_2023']].sum(axis=1)
|
|
|
|
|
78 |
# Ordenar los clientes de mayor a menor según sus ventas totales
|
79 |
ventas_top_100 = ventas_clientes.sort_values(by='total_sales', ascending=False).head(100)
|
80 |
ventas_top_100['total_sales'] = ventas_top_100['total_sales'] / 3
|
81 |
|
|
|
82 |
# Ensure customer codes are strings
|
83 |
df['CLIENTE'] = df['CLIENTE'].astype(str)
|
84 |
nombres_proveedores['codigo'] = nombres_proveedores['codigo'].astype(str)
|
@@ -268,21 +271,19 @@ if page == "📃 Resumen":
|
|
268 |
)}
|
269 |
)
|
270 |
# Calculate sales insights
|
271 |
-
sales_min =
|
272 |
-
sales_max =
|
273 |
-
sales_median =
|
274 |
-
sales_90th =
|
275 |
-
sales_10th =
|
276 |
|
277 |
# About Section with relevant data insights
|
278 |
-
with st.expander('
|
279 |
st.write(f'''
|
280 |
-
- **
|
281 |
-
- **
|
282 |
-
- **
|
283 |
-
- **
|
284 |
-
- **10th Percentile**: €{sales_10th:,.0f}.
|
285 |
-
- This table displays the top 100 clients based on total sales from 2021 to 2023.
|
286 |
''')
|
287 |
# Customer Analysis Page
|
288 |
elif page == "🕵️ Análisis de Cliente":
|
|
|
75 |
|
76 |
# Generamos la columna total_sales
|
77 |
ventas_clientes['total_sales'] = ventas_clientes[['VENTA_2021', 'VENTA_2022', 'VENTA_2023']].sum(axis=1)
|
78 |
+
ventas_clientes_3 = ventas_clientes
|
79 |
+
ventas_clientes_3['total_sales'] = ventas_clientes['total_sales'] / 3
|
80 |
# Ordenar los clientes de mayor a menor según sus ventas totales
|
81 |
ventas_top_100 = ventas_clientes.sort_values(by='total_sales', ascending=False).head(100)
|
82 |
ventas_top_100['total_sales'] = ventas_top_100['total_sales'] / 3
|
83 |
|
84 |
+
|
85 |
# Ensure customer codes are strings
|
86 |
df['CLIENTE'] = df['CLIENTE'].astype(str)
|
87 |
nombres_proveedores['codigo'] = nombres_proveedores['codigo'].astype(str)
|
|
|
271 |
)}
|
272 |
)
|
273 |
# Calculate sales insights
|
274 |
+
sales_min = ventas_clientes['total_sales'].min()
|
275 |
+
sales_max = ventas_clientes['total_sales'].max()
|
276 |
+
sales_median = ventas_clientes['total_sales'].median()
|
277 |
+
sales_90th = ventas_clientes['total_sales'].quantile(0.9)
|
278 |
+
sales_10th = ventas_clientes['total_sales'].quantile(0.1)
|
279 |
|
280 |
# About Section with relevant data insights
|
281 |
+
with st.expander('Análisis Anual', expanded=True):
|
282 |
st.write(f'''
|
283 |
+
- **Rango de ventas**: €{sales_min:,.0f} - €{sales_max:,.0f}.
|
284 |
+
- **Ventas Medianas**: €{sales_median:,.0f} .
|
285 |
+
- **Percentil 90**: €{sales_90th:,.0f}.
|
286 |
+
- **Percentil 10**: €{sales_10th:,.0f}.
|
|
|
|
|
287 |
''')
|
288 |
# Customer Analysis Page
|
289 |
elif page == "🕵️ Análisis de Cliente":
|