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.insert, Index.intersection #58456

Merged
merged 4 commits into from Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -113,8 +113,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
-i "pandas.Index.get_indexer_non_unique PR07,SA01" \
-i "pandas.Index.get_loc PR07,RT03,SA01" \
-i "pandas.Index.identical PR01,SA01" \
-i "pandas.Index.insert PR07,RT03,SA01" \
-i "pandas.Index.intersection PR07,RT03,SA01" \
-i "pandas.Index.join PR07,RT03,SA01" \
-i "pandas.Index.names GL08" \
-i "pandas.Index.nunique RT03" \
Expand Down
19 changes: 19 additions & 0 deletions pandas/core/indexes/base.py
Expand Up @@ -3082,6 +3082,8 @@ def intersection(self, other, sort: bool = False):
Parameters
----------
other : Index or array-like
An Index or an array-like object containing elements to form the
intersection with the original Index.
sort : True, False or None, default False
Whether to sort the resulting index.

Expand All @@ -3093,6 +3095,14 @@ def intersection(self, other, sort: bool = False):
Returns
-------
Index
Returns a new Index object with elements common to both the original Index
and the `other` Index.

See Also
--------
Index.union : Form the union of two Index objects.
Index.difference : Return a new Index with elements of index not in other.
Index.isin : Return a boolean array where the index values are in values.

Examples
--------
Expand Down Expand Up @@ -6624,11 +6634,20 @@ def insert(self, loc: int, item) -> Index:
Parameters
----------
loc : int
An integer representing the location where the new item will be inserted
into the Index.
shriyakalakata marked this conversation as resolved.
Show resolved Hide resolved
item : object
An object representing the new item to be inserted into the Index.
shriyakalakata marked this conversation as resolved.
Show resolved Hide resolved

Returns
-------
Index
Returns a new Index object resulting from inserting the specified item at
the specified location within the original Index.

See Also
--------
Index.append : Append a collection of Index options together.
shriyakalakata marked this conversation as resolved.
Show resolved Hide resolved

Examples
--------
Expand Down