Skip to content

Instantly share code, notes, and snippets.

View dylanjcastillo's full-sized avatar

Dylan Castillo dylanjcastillo

View GitHub Profile
@sainathadapa
sainathadapa / anti_join.py
Created May 9, 2018 10:00
anti-join-pandas
import pandas as pd
def anti_join(x, y, on):
"""Return rows in x which are not present in y"""
ans = pd.merge(left=x, right=y, how='left', indicator=True, on=on)
ans = ans.loc[ans._merge == 'left_only', :].drop(columns='_merge')
return ans
def anti_join_all_cols(x, y):