rairo commited on
Commit
de6a3e2
·
verified ·
1 Parent(s): 4e5cc99

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -56,8 +56,8 @@ def calculate_kpis(df):
56
  else:
57
  top_five_product = "there are less than 5 products in this dataset"
58
 
59
- if df['Name'].nunique() > 1:
60
- best_branch = df.groupby('Name')['Price'].sum().nlargest(1).index.tolist()
61
  else:
62
  best_branch = "there is only one branch in this dataset"
63
 
@@ -66,7 +66,7 @@ def calculate_kpis(df):
66
 
67
  # Calculate Customer Purchase Frequency (Requires more data for accurate calculation)
68
  # Assuming 'Member Card No_' is a unique identifier for customers
69
- customer_purchase_frequency = df.groupby('Name.1')['Receipt No_'].nunique().mean()
70
 
71
  # Calculate Estimated Customer Lifetime Value (CLTV) (Requires more data for accurate calculation)
72
  # Assuming a simple CLTV model based on AOV and purchase frequency
 
56
  else:
57
  top_five_product = "there are less than 5 products in this dataset"
58
 
59
+ if df['Branch_Name'].nunique() > 1:
60
+ best_branch = df.groupby('Branch_Name')['Price'].sum().nlargest(1).index.tolist()
61
  else:
62
  best_branch = "there is only one branch in this dataset"
63
 
 
66
 
67
  # Calculate Customer Purchase Frequency (Requires more data for accurate calculation)
68
  # Assuming 'Member Card No_' is a unique identifier for customers
69
+ customer_purchase_frequency = df.groupby('Customer_Name')['Receipt No_'].nunique().mean()
70
 
71
  # Calculate Estimated Customer Lifetime Value (CLTV) (Requires more data for accurate calculation)
72
  # Assuming a simple CLTV model based on AOV and purchase frequency