Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix PR07,RT03,SA01 errors for Index.union, Index.symmetric_difference #58457

Merged
merged 2 commits into from Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 0 additions & 2 deletions ci/code_checks.sh
Expand Up @@ -123,9 +123,7 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
-i "pandas.Index.reindex PR07" \
-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" \
Expand Down
21 changes: 21 additions & 0 deletions pandas/core/indexes/base.py
Expand Up @@ -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.

Expand All @@ -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.
mroeschke marked this conversation as resolved.
Show resolved Hide resolved
Index.intersection : Form the intersection of two Index objects.
Index.difference : Return a new Index with elements of index not in `other`.

Examples
--------
Expand Down Expand Up @@ -3302,7 +3312,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
Expand All @@ -3316,6 +3329,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
-----
Expand Down