Customer activity rate measures the share of days in a defined period when a customer performs a specified activity. For monthly logins, divide login days by the number of days in that month. section 7.2.2
Use the metric to investigate:
- Overall distributions: most customers are active on 25%–75% of monthly days, while very few exceed 80% or fall below 20%. section 7.2.2
- Segment differences: regional distributions can justify separate baselines, targets, and tracking. section 7.2.2
- Time patterns: compare regions across years and investigate possible seasonality, while verifying apparent changes with relevant teams. section 7.2.2
logins["n_days"] = logins["month"].dt.days_in_month #1
logins["login_days_pct"] = logins["login_days"]/logins["n_days"] #2
sns.histplot(x=logins["login_days_pct"], bins=32) #3
plt.title("Distribution of the % of Days Active Per Month")
plt.xlabel("% of Days Active")
plt.ylabel("# of Records")
Computes monthly active-day percentages and visualizes their distribution with a histogram. section 7.2.2
avg_logins = ( #1
logins.groupby(["month", "region"])["login_days_pct"].mean().reset_index()
)
sns.lineplot(x="month", #2
y="login_days_pct",
hue= "region",
data=avg_logins)
plt.xlabel("Month")
plt.ylabel("Avg. % Days Active")
plt.title("Average % of Monthly Active Days Over Time")
Aggregates customer activity by month and region to compare average rates over time. section 7.2.2
