Data Analyst Interview Series — Part 35
Unternehmen nicht angegeben
Beschreibung
🐍 Data Analyst Interview Series — Part 35
Part 35 — Advanced Business Analysis Using Python
Guys, let's continue our Python Interview Series. Today, we'll solve practical business problems involving customer retention, churn, cohort analysis and business KPIs.
1️⃣ How would you calculate customer retention rate?
Sample Answer:
Customer retention rate measures the percentage of existing customers who remain active during a specific period.
Formula:
Retention Rate = ((Ending Customers − New Customers) / Starting Customers) × 100
Example:
- starting_customers = 1000
- ending_customers = 900
- new_customers = 200
- retention_rate = (
- (ending_customers - new_customers)
- / starting_customers
- ) * 100
print(retention_rate)
2️⃣ How would you identify customers who purchased only once?
Sample Answer:
We can use groupby() and nunique() to count unique orders for each customer.
- order_counts = (
- df.groupby("customer_id")["order_id"]
- .nunique()
- )
- one_time_customers = order_counts[
- order_counts == 1
- ]
print(one_time_customers)
3️⃣ How would you calculate customer lifetime value (CLV) using transaction data?
Sample Answer:
A basic historical CLV calculation is the total revenue generated by each customer.
- customer_clv = (
- df.groupby("customer_id")["revenue"]
- .sum()
- .reset_index(name="CLV")
- )
print(customer_clv)
More advanced CLV models may consider customer lifespan, purchase frequency, margins and future revenue.
4️⃣ How would you calcula