From 9110f7cdac46c69212512635a7fdc99963540c30 Mon Sep 17 00:00:00 2001 From: Tuhin Sharma Date: Thu, 2 May 2024 04:07:33 +0530 Subject: [PATCH] DOC: Enforce Numpy Docstring Validation for pandas.Index.get_loc (#58509) * DOC: add PR07,RT03,SA01 in pandas.Index.get_loc * DOC: remove PR07,RT03,SA01 in pandas.Index.get_loc --- ci/code_checks.sh | 1 - pandas/core/indexes/base.py | 12 ++++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/ci/code_checks.sh b/ci/code_checks.sh index 43c80cf80d487..996f361e9440f 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -82,7 +82,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.get_loc PR07,RT03,SA01" \ -i "pandas.Index.join PR07,RT03,SA01" \ -i "pandas.Index.names GL08" \ -i "pandas.Index.ravel PR01,RT03" \ diff --git a/pandas/core/indexes/base.py b/pandas/core/indexes/base.py index 048362a28dfd7..e93db22906b39 100644 --- a/pandas/core/indexes/base.py +++ b/pandas/core/indexes/base.py @@ -3490,10 +3490,22 @@ def get_loc(self, key): Parameters ---------- key : label + The key to check its location if it is present in the index. Returns ------- int if unique index, slice if monotonic index, else mask + Integer location, slice or boolean mask. + + See Also + -------- + Index.get_slice_bound : Calculate slice bound that corresponds to + given label. + Index.get_indexer : Computes indexer and mask for new index given + the current index. + Index.get_non_unique : Returns indexer and masks for new index given + the current index. + Index.get_indexer_for : Returns an indexer even when non-unique. Examples --------