diff --git a/ci/code_checks.sh b/ci/code_checks.sh index 1724fae98a6e5..8b1bccdaa8d1b 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -106,9 +106,7 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then -i "pandas.Index.ravel PR01,RT03" \ -i "pandas.Index.slice_indexer PR07,RT03,SA01" \ -i "pandas.Index.str PR01,SA01" \ - -i "pandas.Index.symmetric_difference PR07,RT03,SA01" \ -i "pandas.Index.take PR01,PR07" \ - -i "pandas.Index.union PR07,RT03,SA01" \ -i "pandas.Index.view GL08" \ -i "pandas.Int16Dtype SA01" \ -i "pandas.Int32Dtype SA01" \ diff --git a/pandas/core/indexes/base.py b/pandas/core/indexes/base.py index 37bf32aa08ad1..e25c23e9cecdc 100644 --- a/pandas/core/indexes/base.py +++ b/pandas/core/indexes/base.py @@ -2872,6 +2872,8 @@ def union(self, other, sort=None): Parameters ---------- other : Index or array-like + Index or an array-like object containing elements to form the union + with the original Index. sort : bool or None, default None Whether to sort the resulting Index. @@ -2888,6 +2890,14 @@ def union(self, other, sort=None): Returns ------- Index + Returns a new Index object with all unique elements from both the original + Index and the `other` Index. + + See Also + -------- + Index.unique : Return unique values in the index. + Index.intersection : Form the intersection of two Index objects. + Index.difference : Return a new Index with elements of index not in `other`. Examples -------- @@ -3312,7 +3322,10 @@ def symmetric_difference(self, other, result_name=None, sort=None): Parameters ---------- other : Index or array-like + Index or an array-like object with elements to compute the symmetric + difference with the original Index. result_name : str + A string representing the name of the resulting Index, if desired. sort : bool or None, default None Whether to sort the resulting index. By default, the values are attempted to be sorted, but any TypeError from @@ -3326,6 +3339,14 @@ def symmetric_difference(self, other, result_name=None, sort=None): Returns ------- Index + Returns a new Index object containing elements that appear in either the + original Index or the `other` Index, but not both. + + See Also + -------- + Index.difference : Return a new Index with elements of index not in other. + Index.union : Form the union of two Index objects. + Index.intersection : Form the intersection of two Index objects. Notes -----