Spaces:
Sleeping
Sleeping
GMARTINEZMILLA
commited on
Commit
•
8b97595
1
Parent(s):
f93574e
feat: updated app.py
Browse files
app.py
CHANGED
@@ -244,8 +244,23 @@ elif page == "Customer Analysis":
|
|
244 |
sales_data_filtered = sales_data.drop(index='CLIENTE', errors='ignore')
|
245 |
sales_data_filtered = sales_data_filtered.apply(pd.to_numeric, errors='coerce')
|
246 |
|
247 |
-
|
248 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
249 |
combined_top = pd.concat([top_units, top_sales]).index.unique()[:20]
|
250 |
combined_top = [m for m in combined_top if m in all_manufacturers.index and m in sales_data_filtered.index]
|
251 |
|
|
|
244 |
sales_data_filtered = sales_data.drop(index='CLIENTE', errors='ignore')
|
245 |
sales_data_filtered = sales_data_filtered.apply(pd.to_numeric, errors='coerce')
|
246 |
|
247 |
+
# Ensure the values in all_manufacturers are numeric before sorting
|
248 |
+
all_manufacturers_numeric = pd.to_numeric(all_manufacturers.iloc[:, 0], errors='coerce')
|
249 |
+
|
250 |
+
# Sort the manufacturers based on numeric values
|
251 |
+
top_units = all_manufacturers.assign(numeric_values=all_manufacturers_numeric).sort_values(by='numeric_values', ascending=False).head(10)
|
252 |
+
|
253 |
+
# Drop the temporary numeric column after sorting
|
254 |
+
top_units = top_units.drop(columns=['numeric_values'])
|
255 |
+
|
256 |
+
# Ensure the values in sales_data_filtered are numeric before sorting
|
257 |
+
sales_data_filtered_numeric = pd.to_numeric(sales_data_filtered.iloc[:, 0], errors='coerce')
|
258 |
+
|
259 |
+
# Sort the sales data based on numeric values
|
260 |
+
top_sales = sales_data_filtered.assign(numeric_values=sales_data_filtered_numeric).sort_values(by='numeric_values', ascending=False).head(10)
|
261 |
+
|
262 |
+
# Drop the temporary numeric column after sorting
|
263 |
+
top_sales = top_sales.drop(columns=['numeric_values'])
|
264 |
combined_top = pd.concat([top_units, top_sales]).index.unique()[:20]
|
265 |
combined_top = [m for m in combined_top if m in all_manufacturers.index and m in sales_data_filtered.index]
|
266 |
|