Skip to content

Commit

Permalink
Fix PR07,RT03,SA01 errors for Index.insert, Index.intersection (#58456)
Browse files Browse the repository at this point in the history
* Fix PR07,RT03,SA01 errors for Index.insert, Index.intersection

* Update pandas/core/indexes/base.py

Co-authored-by: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com>

* Update pandas/core/indexes/base.py

Co-authored-by: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com>

* Update pandas/core/indexes/base.py

Co-authored-by: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com>

---------

Co-authored-by: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com>
  • Loading branch information
shriyakalakata and mroeschke committed Apr 29, 2024
1 parent a2bce66 commit 2a7ad2e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
2 changes: 0 additions & 2 deletions ci/code_checks.sh
Expand Up @@ -111,8 +111,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
18 changes: 18 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 @@ -6625,11 +6635,19 @@ def insert(self, loc: int, item) -> Index:
Parameters
----------
loc : int
The integer location where the new item will be inserted.
item : object
The new item to be inserted into the Index.
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 Indexes together.
Examples
--------
Expand Down

0 comments on commit 2a7ad2e

Please sign in to comment.