Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# Comparing pages from before and after the switch
true_change = true_totals_after.merge(true_totals_before,
left_on="true_url",
right_on="true_url",
suffixes=["_after", "_before"],
how="outer")
true_change.loc[:, ["ga:newUsers_after", "ga:newUsers_before"]].fillna(0, inplace=True)
true_change['difference'] = true_change['ga:newUsers_after'] - true_change['ga:newUsers_before']
true_change['percent_change'] = true_change['difference'] / true_change['ga:newUsers_before']
true_winners = true_change[true_change['percent_change'] > 0]
true_losers = true_change[true_change['percent_change'] < 0]
true_no_change = true_change[true_change['percent_change'] == 0]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.