Skip to content

Instantly share code, notes, and snippets.

@chrisking
Created September 15, 2018 15:02
Show Gist options
  • Select an option

  • Save chrisking/a0eb9ba08c14150cfff652b2d75dedd6 to your computer and use it in GitHub Desktop.

Select an option

Save chrisking/a0eb9ba08c14150cfff652b2d75dedd6 to your computer and use it in GitHub Desktop.
XOR test
# First XOR
df2 = df[(df['landing_page'] == "new_page")^(df['group'] == "treatment")]
# Second XOR
df3 = df[(df['landing_page'] == "old_page")^(df['group'] == "control")]
print(pd.merge(df2,df3, indicator=True, how='outer')
.query('_merge=="left_only"')
.drop('_merge', axis=1))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment