Skip to content

Commit a052307

Browse files
Fix PR07,RT03,SA01 errors for Index.union, Index.symmetric_difference (#58457)
* Fix PR07,RT03,SA01 errors for Index.union, Index.symmetric_difference * Update pandas/core/indexes/base.py Co-authored-by: Matthew Roeschke <[email protected]> --------- Co-authored-by: Matthew Roeschke <[email protected]>
1 parent 9d3747f commit a052307

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

ci/code_checks.sh

-2
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,7 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
106106
-i "pandas.Index.ravel PR01,RT03" \
107107
-i "pandas.Index.slice_indexer PR07,RT03,SA01" \
108108
-i "pandas.Index.str PR01,SA01" \
109-
-i "pandas.Index.symmetric_difference PR07,RT03,SA01" \
110109
-i "pandas.Index.take PR01,PR07" \
111-
-i "pandas.Index.union PR07,RT03,SA01" \
112110
-i "pandas.Index.view GL08" \
113111
-i "pandas.Int16Dtype SA01" \
114112
-i "pandas.Int32Dtype SA01" \

pandas/core/indexes/base.py

+21
Original file line numberDiff line numberDiff line change
@@ -2872,6 +2872,8 @@ def union(self, other, sort=None):
28722872
Parameters
28732873
----------
28742874
other : Index or array-like
2875+
Index or an array-like object containing elements to form the union
2876+
with the original Index.
28752877
sort : bool or None, default None
28762878
Whether to sort the resulting Index.
28772879
@@ -2888,6 +2890,14 @@ def union(self, other, sort=None):
28882890
Returns
28892891
-------
28902892
Index
2893+
Returns a new Index object with all unique elements from both the original
2894+
Index and the `other` Index.
2895+
2896+
See Also
2897+
--------
2898+
Index.unique : Return unique values in the index.
2899+
Index.intersection : Form the intersection of two Index objects.
2900+
Index.difference : Return a new Index with elements of index not in `other`.
28912901
28922902
Examples
28932903
--------
@@ -3312,7 +3322,10 @@ def symmetric_difference(self, other, result_name=None, sort=None):
33123322
Parameters
33133323
----------
33143324
other : Index or array-like
3325+
Index or an array-like object with elements to compute the symmetric
3326+
difference with the original Index.
33153327
result_name : str
3328+
A string representing the name of the resulting Index, if desired.
33163329
sort : bool or None, default None
33173330
Whether to sort the resulting index. By default, the
33183331
values are attempted to be sorted, but any TypeError from
@@ -3326,6 +3339,14 @@ def symmetric_difference(self, other, result_name=None, sort=None):
33263339
Returns
33273340
-------
33283341
Index
3342+
Returns a new Index object containing elements that appear in either the
3343+
original Index or the `other` Index, but not both.
3344+
3345+
See Also
3346+
--------
3347+
Index.difference : Return a new Index with elements of index not in other.
3348+
Index.union : Form the union of two Index objects.
3349+
Index.intersection : Form the intersection of two Index objects.
33293350
33303351
Notes
33313352
-----

0 commit comments

Comments
 (0)