modin.pandas.Series.compare¶
- Series.compare(other: Series, align_axis: str | int = 1, keep_shape: bool = False, keep_equal: bool = False, result_names: tuple = ('self', 'other')) Series [source]¶
Compare to another Series and show the differences.
- Parameters:
other (Series) – Series to compare with.
align_axis ({{0 or 'index', 1 or 'columns'}}, default 1) –
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.
Snowpark pandas does not yet support 1 / ‘columns’.
keep_shape (bool, default False) –
If true, keep all rows. Otherwise, only keep rows with different values.
Snowpark pandas does not yet support keep_shape = True.
keep_equal (bool, default False) –
If true, keep values that are equal. Otherwise, show equal values as nulls.
Snowpark pandas does not yet support keep_equal = True.
result_names (tuple, default ('self', 'other')) –
How to distinguish this series’s values from the other’s values in the result.
Snowpark pandas does not yet support names other than the default.
- Returns:
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 whose names are result_names.
- Return type:
Series
or Snowpark pandasDataFrame
See also
DataFrame.compare
Show the differences between two DataFrames.
Notes
Matching null values, such as None and NaN, 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