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

DOC: fix PR07 and SA01 issue for Index: copy and get_slice_bound #58443

Merged
merged 2 commits into from
Apr 26, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions ci/code_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
-i "pandas.Grouper PR02" \
-i "pandas.Index PR07" \
-i "pandas.Index.append PR07,RT03,SA01" \
-i "pandas.Index.copy PR07,SA01" \
-i "pandas.Index.difference PR07,RT03,SA01" \
-i "pandas.Index.drop PR07,SA01" \
-i "pandas.Index.droplevel RT03,SA01" \
Expand All @@ -117,7 +116,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
-i "pandas.Index.get_indexer_for PR01,SA01" \
-i "pandas.Index.get_indexer_non_unique PR07,SA01" \
-i "pandas.Index.get_loc PR07,RT03,SA01" \
-i "pandas.Index.get_slice_bound PR07" \
-i "pandas.Index.identical PR01,SA01" \
-i "pandas.Index.inferred_type SA01" \
-i "pandas.Index.insert PR07,RT03,SA01" \
Expand Down
10 changes: 10 additions & 0 deletions pandas/core/indexes/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1262,12 +1262,19 @@ def copy(
name : Label, optional
Set name for new object.
deep : bool, default False
If True attempts to make a deep copy of the Index.
Else makes a shallow copy.

Returns
-------
Index
Index refer to new object which is a copy of this object.

See Also
--------
Index.delete: Make new Index with passed location(-s) deleted.
Index.drop: Make new Index with passed list of labels deleted.

Notes
-----
In most cases, there should be no functional difference from using
Expand Down Expand Up @@ -6382,7 +6389,10 @@ def get_slice_bound(self, label, side: Literal["left", "right"]) -> int:
Parameters
----------
label : object
The label for which to calculate the slice bound.
side : {'left', 'right'}
if 'left' return leftmost position of given label.
if 'right' return one-past-the-rightmost position of given label.

Returns
-------
Expand Down