plydata.two_table_verbs.outer_join

class plydata.two_table_verbs.outer_join(*args, **kwargs)[source]

Join dataframes using the union of keys from both frames

Parameters
xdataframe

Left dataframe

ydataframe

Right dataframe

onstr or tuple or list

Columns on which to join. Must be found in both DataFrames.

left_onlabel or list, 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_onlabel or list, or array-like

Field names to join on in right DataFrame or vector/list of vectors per left_on docs

suffixes2-length sequence

Suffix to apply to overlapping column names in the left and right side, respectively.

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]
... })
...
>>> outer_join(df1, df2, on='col1')
    col1  col2_x  col2_y
0    one     1.0     1.0
1    two     2.0     NaN
2  three     3.0     3.0
3   four     NaN     4.0