# pandas 3.1.0 (BSD-3-Clause), harvested by tools/harvest_corpus.py
=== input

        Compare to another Series and show the differences.

        This method aligns two Series and highlights only the values that
        differ between them. Equal values are shown as NaN by default.

        Parameters
        ----------
        other : Series
            Object to compare with.

        align_axis : {0 or 'index', 1 or 'columns'}, default 1
            Determine which axis to align the comparison on.

            * 0, or 'index' : Resulting differences are stacked vertically
              with rows drawn alternately from self and other.
            * 1, or 'columns' : Resulting differences are aligned horizontally
              with columns drawn alternately from self and other.

        keep_shape : bool, default False
            If true, all rows and columns are kept.
            Otherwise, only the ones with different values are kept.

        keep_equal : bool, default False
            If true, the result keeps values that are equal.
            Otherwise, equal values are shown as NaNs.

        result_names : tuple, default ('self', 'other')
            Set the dataframes names in the comparison.

        Returns
        -------
        Series or DataFrame
            If axis is 0 or 'index' the result will be a Series.
            The resulting index will be a MultiIndex with 'self' and 'other'
            stacked alternately at the inner level.

            If axis is 1 or 'columns' the result will be a DataFrame.
            It will have two columns namely 'self' and 'other'.

        See Also
        --------
        DataFrame.compare : Compare with another DataFrame and show differences.

        Notes
        -----
        Matching NaNs will not appear as a difference.

        Examples
        --------
        >>> s1 = pd.Series(["a", "b", "c", "d", "e"])
        >>> s2 = pd.Series(["a", "a", "c", "b", "e"])

        Align the differences on columns

        >>> s1.compare(s2)
          self other
        1    b     a
        3    d     b

        Stack the differences on indices

        >>> s1.compare(s2, align_axis=0)
        1  self     b
           other    a
        3  self     d
           other    b
        dtype: str

        Keep all original rows

        >>> s1.compare(s2, keep_shape=True)
          self other
        0  NaN   NaN
        1    b     a
        2  NaN   NaN
        3    d     b
        4  NaN   NaN

        Keep all original rows and also all original values

        >>> s1.compare(s2, keep_shape=True, keep_equal=True)
          self other
        0    a     a
        1    b     a
        2    c     c
        3    d     b
        4    e     e
        
=== parse numpydoc
short_description: 'Compare to another Series and show the differences.'
long_description: |
  This method aligns two Series and highlights only the values that
  differ between them. Equal values are shown as NaN by default.
blank_after_short_description: True
blank_after_long_description: True
style: numpydoc
- DocstringParam
  description: 'Object to compare with.'
  kind: param
  key: 'param'
  arg_name: 'other'
  type_name: 'Series'
  is_optional: False
- DocstringParam
  description: |
    Determine which axis to align the comparison on.
    
    * 0, or 'index' : Resulting differences are stacked vertically
      with rows drawn alternately from self and other.
    * 1, or 'columns' : Resulting differences are aligned horizontally
      with columns drawn alternately from self and other.
  kind: param
  key: 'param'
  arg_name: 'align_axis'
  type_name: "{0 or 'index', 1 or 'columns'}"
  is_optional: True
  default: '1'
  raw_type_name: "{0 or 'index', 1 or 'columns'}, default 1"
- DocstringParam
  description: |
    If true, all rows and columns are kept.
    Otherwise, only the ones with different values are kept.
  kind: param
  key: 'param'
  arg_name: 'keep_shape'
  type_name: 'bool'
  is_optional: True
  default: 'False'
  raw_type_name: 'bool, default False'
- DocstringParam
  description: |
    If true, the result keeps values that are equal.
    Otherwise, equal values are shown as NaNs.
  kind: param
  key: 'param'
  arg_name: 'keep_equal'
  type_name: 'bool'
  is_optional: True
  default: 'False'
  raw_type_name: 'bool, default False'
- DocstringParam
  description: 'Set the dataframes names in the comparison.'
  kind: param
  key: 'param'
  arg_name: 'result_names'
  type_name: 'tuple'
  is_optional: True
  default: "('self', 'other')"
  raw_type_name: "tuple, default ('self', 'other')"
- DocstringReturns
  description: |
    If axis is 0 or 'index' the result will be a Series.
    The resulting index will be a MultiIndex with 'self' and 'other'
    stacked alternately at the inner level.
    
    If axis is 1 or 'columns' the result will be a DataFrame.
    It will have two columns namely 'self' and 'other'.
  kind: returns
  key: 'returns'
  type_name: 'Series or DataFrame'
  is_generator: False
- DocstringMeta
  description: 'DataFrame.compare : Compare with another DataFrame and show differences.'
  kind: text
  key: 'see_also'
  title: 'See Also'
- DocstringMeta
  description: 'Matching NaNs will not appear as a difference.'
  kind: text
  key: 'notes'
  title: 'Notes'
- DocstringExample
  kind: examples
  key: 'examples'
  snippet: '>>> s1 = pd.Series(["a", "b", "c", "d", "e"])'
- DocstringExample
  kind: examples
  key: 'examples'
  snippet: '>>> s2 = pd.Series(["a", "a", "c", "b", "e"])'
- DocstringExample
  description: 'Align the differences on columns'
  kind: examples
  key: 'examples'
  snippet: |
    >>> s1.compare(s2)
      self other
    1    b     a
    3    d     b
- DocstringExample
  description: 'Stack the differences on indices'
  kind: examples
  key: 'examples'
  snippet: |
    >>> s1.compare(s2, align_axis=0)
    1  self     b
       other    a
    3  self     d
       other    b
    dtype: str
- DocstringExample
  description: 'Keep all original rows'
  kind: examples
  key: 'examples'
  snippet: |
    >>> s1.compare(s2, keep_shape=True)
      self other
    0  NaN   NaN
    1    b     a
    2  NaN   NaN
    3    d     b
    4  NaN   NaN
- DocstringExample
  description: 'Keep all original rows and also all original values'
  kind: examples
  key: 'examples'
  snippet: |
    >>> s1.compare(s2, keep_shape=True, keep_equal=True)
      self other
    0    a     a
    1    b     a
    2    c     c
    3    d     b
    4    e     e
=== detect
numpydoc
=== compose numpydoc
Compare to another Series and show the differences.

This method aligns two Series and highlights only the values that
differ between them. Equal values are shown as NaN by default.

Parameters
----------
other : Series
    Object to compare with.
align_axis : {0 or 'index', 1 or 'columns'}, default 1
    Determine which axis to align the comparison on.

    * 0, or 'index' : Resulting differences are stacked vertically
      with rows drawn alternately from self and other.
    * 1, or 'columns' : Resulting differences are aligned horizontally
      with columns drawn alternately from self and other.
keep_shape : bool, default False
    If true, all rows and columns are kept.
    Otherwise, only the ones with different values are kept.
keep_equal : bool, default False
    If true, the result keeps values that are equal.
    Otherwise, equal values are shown as NaNs.
result_names : tuple, default ('self', 'other')
    Set the dataframes names in the comparison.

Returns
-------
Series or DataFrame
    If axis is 0 or 'index' the result will be a Series.
    The resulting index will be a MultiIndex with 'self' and 'other'
    stacked alternately at the inner level.

    If axis is 1 or 'columns' the result will be a DataFrame.
    It will have two columns namely 'self' and 'other'.

See Also
--------
DataFrame.compare : Compare with another DataFrame and show differences.

Notes
-----
Matching NaNs will not appear as a difference.

Examples
--------
>>> s1 = pd.Series(["a", "b", "c", "d", "e"])
>>> s2 = pd.Series(["a", "a", "c", "b", "e"])

Align the differences on columns

>>> s1.compare(s2)
  self other
1    b     a
3    d     b

Stack the differences on indices

>>> s1.compare(s2, align_axis=0)
1  self     b
   other    a
3  self     d
   other    b
dtype: str

Keep all original rows

>>> s1.compare(s2, keep_shape=True)
  self other
0  NaN   NaN
1    b     a
2  NaN   NaN
3    d     b
4  NaN   NaN

Keep all original rows and also all original values

>>> s1.compare(s2, keep_shape=True, keep_equal=True)
  self other
0    a     a
1    b     a
2    c     c
3    d     b
4    e     e
