From f626877cc0b5fdc9561b6624b143f95da3556001 Mon Sep 17 00:00:00 2001 From: KeiOshima Date: Fri, 26 Apr 2024 11:33:09 -0400 Subject: [PATCH 1/2] DOC: fix PR07 and SA01 issue for Index: copy and get_slice_bound --- ci/code_checks.sh | 2 -- pandas/core/indexes/base.py | 9 +++++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ci/code_checks.sh b/ci/code_checks.sh index 9aae477ca1af3..fbdda3efa58e8 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -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" \ @@ -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" \ diff --git a/pandas/core/indexes/base.py b/pandas/core/indexes/base.py index ace082fba609a..8a0a9e09de07f 100644 --- a/pandas/core/indexes/base.py +++ b/pandas/core/indexes/base.py @@ -1262,12 +1262,18 @@ 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 @@ -6382,7 +6388,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 ------- From ab483cbfda83a586edd1fe0b7c3474e43d7ba16d Mon Sep 17 00:00:00 2001 From: KeiOshima Date: Fri, 26 Apr 2024 11:38:51 -0400 Subject: [PATCH 2/2] ficing line to long error --- pandas/core/indexes/base.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pandas/core/indexes/base.py b/pandas/core/indexes/base.py index 8a0a9e09de07f..175782c892e40 100644 --- a/pandas/core/indexes/base.py +++ b/pandas/core/indexes/base.py @@ -1262,7 +1262,8 @@ 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. + If True attempts to make a deep copy of the Index. + Else makes a shallow copy. Returns -------