MCPcopy
hub / github.com/pandas-dev/pandas / align

Method align

pandas/core/generic.py:9693–9858  ·  view source on GitHub ↗

Align two objects on their axes with the specified join method. Join method is specified for each axis Index. Parameters ---------- other : DataFrame or Series The object to align with. join : {'outer', 'inner', 'left', 'right'}, default

(
        self,
        other: NDFrameT,
        join: AlignJoin = "outer",
        axis: Axis | None = None,
        level: Level | None = None,
        copy: bool | lib.NoDefault = lib.no_default,
        fill_value: Hashable | None = None,
    )

Source from the content-addressed store, hash-verified

9691
9692 @final
9693 def align(
9694 self,
9695 other: NDFrameT,
9696 join: AlignJoin = "outer",
9697 axis: Axis | None = None,
9698 level: Level | None = None,
9699 copy: bool | lib.NoDefault = lib.no_default,
9700 fill_value: Hashable | None = None,
9701 ) -> tuple[Self, NDFrameT]:
9702 """
9703 Align two objects on their axes with the specified join method.
9704
9705 Join method is specified for each axis Index.
9706
9707 Parameters
9708 ----------
9709 other : DataFrame or Series
9710 The object to align with.
9711 join : {'outer', 'inner', 'left', 'right'}, default 'outer'
9712 Type of alignment to be performed.
9713
9714 * left: use only keys from left frame, preserve key order.
9715 * right: use only keys from right frame, preserve key order.
9716 * outer: use union of keys from both frames, sort keys lexicographically.
9717 * inner: use intersection of keys from both frames,
9718 preserve the order of the left keys.
9719
9720 axis : allowed axis of the other object, default None
9721 Align on index (0), columns (1), or both (None).
9722 level : int or level name, default None
9723 Broadcast across a level, matching Index values on the
9724 passed MultiIndex level.
9725 copy : bool, default False
9726 This keyword is now ignored; changing its value will have no
9727 impact on the method.
9728
9729 .. deprecated:: 3.0.0
9730
9731 This keyword is ignored and will be removed in pandas 4.0. Since
9732 pandas 3.0, this method always returns a new object using a lazy
9733 copy mechanism that defers copies until necessary
9734 (Copy-on-Write). See the `user guide on Copy-on-Write
9735 <https://pandas.pydata.org/docs/dev/user_guide/copy_on_write.html>`__
9736 for more details.
9737
9738 fill_value : scalar, default np.nan
9739 Value to use for missing values. Defaults to NaN, but can be any
9740 "compatible" value.
9741
9742 Returns
9743 -------
9744 tuple of (Series/DataFrame, type of other)
9745 Aligned objects.
9746
9747 See Also
9748 --------
9749 Series.align : Align two objects on their axes with specified join method.
9750 DataFrame.align : Align two objects on their axes with specified join method.

Callers 15

_whereMethod · 0.95
time_align_levelMethod · 0.80
corrMethod · 0.80
covMethod · 0.80
_align_for_opMethod · 0.80
_binopMethod · 0.80
union_with_duplicatesFunction · 0.80
_align_for_opMethod · 0.80
combineMethod · 0.80
corrwithMethod · 0.80
catMethod · 0.80

Calls 6

_get_axis_numberMethod · 0.95
_align_frameMethod · 0.95
_align_seriesMethod · 0.95
__finalize__Method · 0.80
copyMethod · 0.45