def align(self, other: DataFrameOrSeries, join: str='outer', axis: Optional[Axis]=None, copy: bool=True) -> Tuple[('DataFrame', DataFrameOrSeries)]:
    '\n        Align two objects on their axes with the specified join method.\n\n        Join method is specified for each axis Index.\n\n        Parameters\n        ----------\n        other : DataFrame or Series\n        join : {{\'outer\', \'inner\', \'left\', \'right\'}}, default \'outer\'\n        axis : allowed axis of the other object, default None\n            Align on index (0), columns (1), or both (None).\n        copy : bool, default True\n            Always returns new objects. If copy=False and no reindexing is\n            required then original objects are returned.\n\n        Returns\n        -------\n        (left, right) : (DataFrame, type of other)\n            Aligned objects.\n\n        Examples\n        --------\n        >>> ps.set_option("compute.ops_on_diff_frames", True)\n        >>> df1 = ps.DataFrame({"a": [1, 2, 3], "b": ["a", "b", "c"]}, index=[10, 20, 30])\n        >>> df2 = ps.DataFrame({"a": [4, 5, 6], "c": ["d", "e", "f"]}, index=[10, 11, 12])\n\n        Align both axis:\n\n        >>> aligned_l, aligned_r = df1.align(df2)\n        >>> aligned_l.sort_index()\n              a     b   c\n        10  1.0     a NaN\n        11  NaN  None NaN\n        12  NaN  None NaN\n        20  2.0     b NaN\n        30  3.0     c NaN\n        >>> aligned_r.sort_index()\n              a   b     c\n        10  4.0 NaN     d\n        11  5.0 NaN     e\n        12  6.0 NaN     f\n        20  NaN NaN  None\n        30  NaN NaN  None\n\n        Align only axis=0 (index):\n\n        >>> aligned_l, aligned_r = df1.align(df2, axis=0)\n        >>> aligned_l.sort_index()\n              a     b\n        10  1.0     a\n        11  NaN  None\n        12  NaN  None\n        20  2.0     b\n        30  3.0     c\n        >>> aligned_r.sort_index()\n              a     c\n        10  4.0     d\n        11  5.0     e\n        12  6.0     f\n        20  NaN  None\n        30  NaN  None\n\n        Align only axis=1 (column):\n\n        >>> aligned_l, aligned_r = df1.align(df2, axis=1)\n        >>> aligned_l.sort_index()\n            a  b   c\n        10  1  a NaN\n        20  2  b NaN\n        30  3  c NaN\n        >>> aligned_r.sort_index()\n            a   b  c\n        10  4 NaN  d\n        11  5 NaN  e\n        12  6 NaN  f\n\n        Align with the join type "inner":\n\n        >>> aligned_l, aligned_r = df1.align(df2, join="inner")\n        >>> aligned_l.sort_index()\n            a\n        10  1\n        >>> aligned_r.sort_index()\n            a\n        10  4\n\n        Align with a Series:\n\n        >>> s = ps.Series([7, 8, 9], index=[10, 11, 12])\n        >>> aligned_l, aligned_r = df1.align(s, axis=0)\n        >>> aligned_l.sort_index()\n              a     b\n        10  1.0     a\n        11  NaN  None\n        12  NaN  None\n        20  2.0     b\n        30  3.0     c\n        >>> aligned_r.sort_index()\n        10    7.0\n        11    8.0\n        12    9.0\n        20    NaN\n        30    NaN\n        dtype: float64\n\n        >>> ps.reset_option("compute.ops_on_diff_frames")\n        '
    from pyspark.pandas.series import Series, first_series
    if (not isinstance(other, (DataFrame, Series))):
        raise TypeError('unsupported type: {}'.format(type(other).__name__))
    how = validate_how(join)
    axis = validate_axis(axis, None)
    right_is_series = isinstance(other, Series)
    if right_is_series:
        if (axis is None):
            raise ValueError('Must specify axis=0 or 1')
        elif (axis != 0):
            raise NotImplementedError('align currently only works for axis=0 when right is Series')
    left = self
    right = other
    if (((axis is None) or (axis == 0)) and (not same_anchor(left, right))):
        combined = combine_frames(left, right, how=how)
        left = combined['this']
        right = combined['that']
        if right_is_series:
            right = first_series(cast(DataFrame[Any], right)).rename(other.name)
    if (((axis is None) or (axis == 1)) and (left._internal.column_labels != right._internal.column_labels)):
        if (left._internal.column_labels_level != right._internal.column_labels_level):
            raise ValueError('cannot join with no overlapping index names')
        left = left.copy()
        right = right.copy()
        if (how == 'full'):
            column_labels = sorted(list((set(left._internal.column_labels) | set(right._internal.column_labels))))
        elif (how == 'inner'):
            column_labels = sorted(list((set(left._internal.column_labels) & set(right._internal.column_labels))))
        elif (how == 'left'):
            column_labels = left._internal.column_labels
        else:
            column_labels = right._internal.column_labels
        for label in column_labels:
            if (label not in left._internal.column_labels):
                left[label] = SF.lit(None).cast(DoubleType())
        left = left[column_labels]
        for label in column_labels:
            if (label not in right._internal.column_labels):
                right[label] = SF.lit(None).cast(DoubleType())
        right = right[column_labels]
    return ((left.copy(), right.copy()) if copy else (left, right))
Align two objects on their axes with the specified join method.

Join method is specified for each axis Index.

Parameters
----------
other : DataFrame or Series
join : {{'outer', 'inner', 'left', 'right'}}, default 'outer'
axis : allowed axis of the other object, default None
    Align on index (0), columns (1), or both (None).
copy : bool, default True
    Always returns new objects. If copy=False and no reindexing is
    required then original objects are returned.

Returns
-------
(left, right) : (DataFrame, type of other)
    Aligned objects.

Examples
--------
>>> ps.set_option("compute.ops_on_diff_frames", True)
>>> df1 = ps.DataFrame({"a": [1, 2, 3], "b": ["a", "b", "c"]}, index=[10, 20, 30])
>>> df2 = ps.DataFrame({"a": [4, 5, 6], "c": ["d", "e", "f"]}, index=[10, 11, 12])

Align both axis:

>>> aligned_l, aligned_r = df1.align(df2)
>>> aligned_l.sort_index()
      a     b   c
10  1.0     a NaN
11  NaN  None NaN
12  NaN  None NaN
20  2.0     b NaN
30  3.0     c NaN
>>> aligned_r.sort_index()
      a   b     c
10  4.0 NaN     d
11  5.0 NaN     e
12  6.0 NaN     f
20  NaN NaN  None
30  NaN NaN  None

Align only axis=0 (index):

>>> aligned_l, aligned_r = df1.align(df2, axis=0)
>>> aligned_l.sort_index()
      a     b
10  1.0     a
11  NaN  None
12  NaN  None
20  2.0     b
30  3.0     c
>>> aligned_r.sort_index()
      a     c
10  4.0     d
11  5.0     e
12  6.0     f
20  NaN  None
30  NaN  None

Align only axis=1 (column):

>>> aligned_l, aligned_r = df1.align(df2, axis=1)
>>> aligned_l.sort_index()
    a  b   c
10  1  a NaN
20  2  b NaN
30  3  c NaN
>>> aligned_r.sort_index()
    a   b  c
10  4 NaN  d
11  5 NaN  e
12  6 NaN  f

Align with the join type "inner":

>>> aligned_l, aligned_r = df1.align(df2, join="inner")
>>> aligned_l.sort_index()
    a
10  1
>>> aligned_r.sort_index()
    a
10  4

Align with a Series:

>>> s = ps.Series([7, 8, 9], index=[10, 11, 12])
>>> aligned_l, aligned_r = df1.align(s, axis=0)
>>> aligned_l.sort_index()
      a     b
10  1.0     a
11  NaN  None
12  NaN  None
20  2.0     b
30  3.0     c
>>> aligned_r.sort_index()
10    7.0
11    8.0
12    9.0
20    NaN
30    NaN
dtype: float64

>>> ps.reset_option("compute.ops_on_diff_frames")
def align(self, other: DataFrameOrSeries, join: str='outer', axis: Optional[Axis]=None, copy: bool=True) -> Tuple[('DataFrame', DataFrameOrSeries)]:
    '\n        Align two objects on their axes with the specified join method.\n\n        Join method is specified for each axis Index.\n\n        Parameters\n        ----------\n        other : DataFrame or Series\n        join : {{\'outer\', \'inner\', \'left\', \'right\'}}, default \'outer\'\n        axis : allowed axis of the other object, default None\n            Align on index (0), columns (1), or both (None).\n        copy : bool, default True\n            Always returns new objects. If copy=False and no reindexing is\n            required then original objects are returned.\n\n        Returns\n        -------\n        (left, right) : (DataFrame, type of other)\n            Aligned objects.\n\n        Examples\n        --------\n        >>> ps.set_option("compute.ops_on_diff_frames", True)\n        >>> df1 = ps.DataFrame({"a": [1, 2, 3], "b": ["a", "b", "c"]}, index=[10, 20, 30])\n        >>> df2 = ps.DataFrame({"a": [4, 5, 6], "c": ["d", "e", "f"]}, index=[10, 11, 12])\n\n        Align both axis:\n\n        >>> aligned_l, aligned_r = df1.align(df2)\n        >>> aligned_l.sort_index()\n              a     b   c\n        10  1.0     a NaN\n        11  NaN  None NaN\n        12  NaN  None NaN\n        20  2.0     b NaN\n        30  3.0     c NaN\n        >>> aligned_r.sort_index()\n              a   b     c\n        10  4.0 NaN     d\n        11  5.0 NaN     e\n        12  6.0 NaN     f\n        20  NaN NaN  None\n        30  NaN NaN  None\n\n        Align only axis=0 (index):\n\n        >>> aligned_l, aligned_r = df1.align(df2, axis=0)\n        >>> aligned_l.sort_index()\n              a     b\n        10  1.0     a\n        11  NaN  None\n        12  NaN  None\n        20  2.0     b\n        30  3.0     c\n        >>> aligned_r.sort_index()\n              a     c\n        10  4.0     d\n        11  5.0     e\n        12  6.0     f\n        20  NaN  None\n        30  NaN  None\n\n        Align only axis=1 (column):\n\n        >>> aligned_l, aligned_r = df1.align(df2, axis=1)\n        >>> aligned_l.sort_index()\n            a  b   c\n        10  1  a NaN\n        20  2  b NaN\n        30  3  c NaN\n        >>> aligned_r.sort_index()\n            a   b  c\n        10  4 NaN  d\n        11  5 NaN  e\n        12  6 NaN  f\n\n        Align with the join type "inner":\n\n        >>> aligned_l, aligned_r = df1.align(df2, join="inner")\n        >>> aligned_l.sort_index()\n            a\n        10  1\n        >>> aligned_r.sort_index()\n            a\n        10  4\n\n        Align with a Series:\n\n        >>> s = ps.Series([7, 8, 9], index=[10, 11, 12])\n        >>> aligned_l, aligned_r = df1.align(s, axis=0)\n        >>> aligned_l.sort_index()\n              a     b\n        10  1.0     a\n        11  NaN  None\n        12  NaN  None\n        20  2.0     b\n        30  3.0     c\n        >>> aligned_r.sort_index()\n        10    7.0\n        11    8.0\n        12    9.0\n        20    NaN\n        30    NaN\n        dtype: float64\n\n        >>> ps.reset_option("compute.ops_on_diff_frames")\n        '
    from pyspark.pandas.series import Series, first_series
    if (not isinstance(other, (DataFrame, Series))):
        raise TypeError('unsupported type: {}'.format(type(other).__name__))
    how = validate_how(join)
    axis = validate_axis(axis, None)
    right_is_series = isinstance(other, Series)
    if right_is_series:
        if (axis is None):
            raise ValueError('Must specify axis=0 or 1')
        elif (axis != 0):
            raise NotImplementedError('align currently only works for axis=0 when right is Series')
    left = self
    right = other
    if (((axis is None) or (axis == 0)) and (not same_anchor(left, right))):
        combined = combine_frames(left, right, how=how)
        left = combined['this']
        right = combined['that']
        if right_is_series:
            right = first_series(cast(DataFrame[Any], right)).rename(other.name)
    if (((axis is None) or (axis == 1)) and (left._internal.column_labels != right._internal.column_labels)):
        if (left._internal.column_labels_level != right._internal.column_labels_level):
            raise ValueError('cannot join with no overlapping index names')
        left = left.copy()
        right = right.copy()
        if (how == 'full'):
            column_labels = sorted(list((set(left._internal.column_labels) | set(right._internal.column_labels))))
        elif (how == 'inner'):
            column_labels = sorted(list((set(left._internal.column_labels) & set(right._internal.column_labels))))
        elif (how == 'left'):
            column_labels = left._internal.column_labels
        else:
            column_labels = right._internal.column_labels
        for label in column_labels:
            if (label not in left._internal.column_labels):
                left[label] = SF.lit(None).cast(DoubleType())
        left = left[column_labels]
        for label in column_labels:
            if (label not in right._internal.column_labels):
                right[label] = SF.lit(None).cast(DoubleType())
        right = right[column_labels]
    return ((left.copy(), right.copy()) if copy else (left, right))