plydata.two_table_verbs.anti_join¶
-
class
plydata.two_table_verbs.
anti_join
(*args, **kwargs)[source]¶ Join and keep rows only found in left frame
Also keeps just the columns in the left frame. An
anti_join
is analogous to a set difference.- Parameters
- x
dataframe
Left dataframe
- y
dataframe
Right dataframe
- on
str
ortuple
orlist
Columns on which to join. Must be found in both DataFrames.
- left_on
label
orlist
,or
array-like Field names to join on in left DataFrame. Can be a vector or list of vectors of the length of the DataFrame to use a particular vector as the join key instead of columns
- right_on
label
orlist
,or
array-like Field names to join on in right DataFrame or vector/list of vectors per left_on docs
- x
Notes
Groups are ignored for the purpose of joining, but the result preserves the grouping of x.
Examples
>>> import pandas as pd >>> df1 = pd.DataFrame({ ... 'col1': ['one', 'two', 'three'], ... 'col2': [1, 2, 3] ... }) ... >>> df2 = pd.DataFrame({ ... 'col1': ['one', 'four', 'three'], ... 'col2': [1, 4, 3] ... }) ... >>> anti_join(df1, df2, on='col1') col1 col2 1 two 2