Created
February 28, 2019 22:15
-
-
Save hamletbatista/8ad1128c88521dc51e0d12655b1ff986 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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