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.append, Index.difference #58453

Merged
merged 3 commits into from Apr 30, 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 @@ -88,8 +88,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
-i "pandas.DataFrame.var PR01,RT03,SA01" \
-i "pandas.Grouper PR02" \
-i "pandas.Index PR07" \
-i "pandas.Index.append PR07,RT03,SA01" \
-i "pandas.Index.difference PR07,RT03,SA01" \
-i "pandas.Index.get_indexer PR07,SA01" \
-i "pandas.Index.get_indexer_for PR01,SA01" \
-i "pandas.Index.get_indexer_non_unique PR07,SA01" \
Expand Down
18 changes: 18 additions & 0 deletions pandas/core/indexes/base.py
Expand Up @@ -3261,6 +3261,8 @@ def difference(self, other, sort=None):
Parameters
----------
other : Index or array-like
Index object or an array-like object containing elements to be compared
with the elements of the original Index.
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 @@ -3274,6 +3276,14 @@ def difference(self, other, sort=None):
Returns
-------
Index
Returns a new Index object containing elements that are in the original
Index but not in the `other` Index.

See Also
--------
Index.symmetric_difference : Compute the symmetric difference of two Index
objects.
Index.intersection : Form the intersection of two Index objects.

Examples
--------
Expand Down Expand Up @@ -5156,10 +5166,18 @@ def append(self, other: Index | Sequence[Index]) -> Index:
Parameters
----------
other : Index or list/tuple of indices
Single Index or a collection of indices, which can be either a list or a
tuple.

Returns
-------
Index
Returns a new Index object resulting from appending the provided other
indices to the original Index.

See Also
--------
Index.insert : Make new Index inserting new item at location.

Examples
--------
Expand Down