Compare to another Series and show the differences.
Object to compare with.
Determine which axis to align the comparison on.
with rows drawn alternately from self and other.
with columns drawn alternately from self and other.
If true, all rows and columns are kept. Otherwise, only the ones with different values are kept.
If true, the result keeps values that are equal. Otherwise, equal values are shown as NaNs.
Set the dataframes names in the comparison.
Added in version 1.5.0.
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â.
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: object
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
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4