pandas.DataFrame.join

pandas 3.1.1 · DataFrame · method

Combine tables using index labels or a specified key in the calling table.

Call syntax

DataFrame.join(…) Full signature
DataFrame.join(
    other,
    on=None,
    how='left',
    lsuffix=…,
    rsuffix=…,
    sort=False,
    validate=None,
    *,
    suffixes=…,
)

Run the example

Edit the example and select Run Python to see the result.

Parameters

ParameterRequirementAccepted values and behavior
other Required
Positional or keyword
DataFrame, Series, or a list containing any combination of them

Supply the second object or value used in the operation.

on Optional
Positional or keyword
Default None
str, list of str, or array-like

Choose the shared key columns or name the axis column used by the operation.

how Optional
Positional or keyword
Default 'left'
{'left', 'right', 'outer', 'inner', 'cross', 'left_anti', 'right_anti'}

Choose a policy such as a join type or a missing-value removal rule.

lsuffix Optional
Positional or keyword
str

When omitted, the documented default is ''.

rsuffix Optional
Positional or keyword
str

When omitted, the documented default is ''.

sort Optional
Positional or keyword
Default False
bool

Choose whether the resulting labels or groups are sorted where supported.

validate Optional
Positional or keyword
Default None
str

Check that key multiplicity matches the required relationship, such as "one_to_one" or "many_to_one".

suffixes Optional
Keyword only
tuple of (str, str)

Supply a pair for resolving duplicate column names in joined tables.

Returns

DataFrame