pandas.DataFrame.align

pandas 3.1.1 · DataFrame · method

Return two objects with compatible labels. Set join to choose which labels to retain.

Call syntax

DataFrame.align(other, join='outer', axis=None, level=None, copy=…, fill_value=None)

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 or Series

Supply the second object or value used in the operation.

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

Select which labels to retain when bringing multiple axes into alignment.

axis Optional
Positional or keyword
Default None
allowed axis of the other object

Choose which axis the operation acts on. The accepted axis labels depend on the receiver.

level Optional
Positional or keyword
Default None
int or level name

Choose an index level by name or integer position.

copy Optional
Positional or keyword
bool

Control whether data is copied where the API supports that choice.

fill_value Optional
Positional or keyword
Default None
scalar

Supply a value to use in place of a missing position.

Returns

tuple of (Series/DataFrame, type of other)