Skip to content

Instantly share code, notes, and snippets.

@hamletbatista
Created February 28, 2019 22:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hamletbatista/8dc548a1918abdd6a7160e012307634a to your computer and use it in GitHub Desktop.
Save hamletbatista/8dc548a1918abdd6a7160e012307634a to your computer and use it in GitHub Desktop.
true_before = data_redirects[data_redirects['ga:date'] < pd.to_datetime(MIDPOINT_DATE)]
true_after = data_redirects[data_redirects['ga:date'] >= pd.to_datetime(MIDPOINT_DATE)]
# Traffic totals before shopify switch
true_totals_before = true_before[["true_url", "ga:newUsers"]]\
.groupby("true_url").sum()
true_totals_before = true_totals_before.reset_index()\
.sort_values("ga:newUsers", ascending=False)
# Traffic totals after shopify switch
true_totals_after = true_after[["true_url", "ga:newUsers"]]\
.groupby("true_url").sum()
true_totals_after = true_totals_after.reset_index()\
.sort_values("ga:newUsers", ascending=False)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment