pandas.merge_ordered

pandas 3.1.1 · General functions · function

Join ordered data such as time series, with optional forward-filling across the merged sequence.

Call syntax

pd.merge_ordered(…) Full signature
pd.merge_ordered(
    left,
    right,
    on=None,
    left_on=None,
    right_on=None,
    left_by=None,
    right_by=None,
    fill_method=None,
    suffixes=('_x', '_y'),
    how='outer',
)

Run the example

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

Parameters

ParameterRequirementAccepted values and behavior
left Required
Positional or keyword
DataFrame or named Series

Supply the left-hand input or the left endpoint of the interval.

right Required
Positional or keyword
DataFrame or named Series

Supply the right-hand input or the right endpoint of the interval.

on Optional
Positional or keyword
Default None
Hashable or a sequence of the previous

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

left_on Optional
Positional or keyword
Default None
Hashable or a sequence of the previous, or array-like

Identify the join keys in the left-hand object.

right_on Optional
Positional or keyword
Default None
Hashable or a sequence of the previous, or array-like

Identify the join keys in the right-hand object.

left_by Optional
Positional or keyword
Default None
column name or list of column names

Group or partition the left input by these keys before the match.

right_by Optional
Positional or keyword
Default None
column name or list of column names

Group or partition the right input by these keys before the match.

fill_method Optional
Positional or keyword
Default None
{'ffill', None}

Choose how missing values are filled before or during alignment.

suffixes Optional
Positional or keyword
Default ('_x', '_y')
list-like

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

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

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

Returns

DataFrame