From 69354aaadd16aaa48013076abb78b5c7f2902620 Mon Sep 17 00:00:00 2001 From: DhruvBShetty Date: Fri, 24 Sep 2021 23:05:17 +0530 Subject: [PATCH 1/5] Added sentence to show that unmatched values return -1 --- pandas/core/indexes/base.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pandas/core/indexes/base.py b/pandas/core/indexes/base.py index 64ba18271100e..d3c47e2952299 100644 --- a/pandas/core/indexes/base.py +++ b/pandas/core/indexes/base.py @@ -3348,6 +3348,9 @@ def get_loc(self, key, method=None, tolerance=None): Compute indexer and mask for new index given the current index. The indexer should be then used as an input to ndarray.take to align the current data to the new index. + + Returns -1 for unmatched values, for further explanation see the example + below. Parameters ---------- From fcc78570d570c54a2b233dbb0741690282395698 Mon Sep 17 00:00:00 2001 From: DhruvBShetty Date: Sat, 25 Sep 2021 19:06:59 +0530 Subject: [PATCH 2/5] Fixed PEP 8 issues --- pandas/core/indexes/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/core/indexes/base.py b/pandas/core/indexes/base.py index 7208790427f99..519234276793e 100644 --- a/pandas/core/indexes/base.py +++ b/pandas/core/indexes/base.py @@ -3483,7 +3483,7 @@ def get_loc(self, key, method=None, tolerance=None): Compute indexer and mask for new index given the current index. The indexer should be then used as an input to ndarray.take to align the current data to the new index. - + Returns -1 for unmatched values, for further explanation see the example below. From 769d5b2d57572f1b9ff4aad726969cc45f4ed783 Mon Sep 17 00:00:00 2001 From: DhruvBShetty Date: Mon, 1 Nov 2021 01:35:36 +0530 Subject: [PATCH 3/5] Added note --- pandas/core/indexes/base.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pandas/core/indexes/base.py b/pandas/core/indexes/base.py index 519234276793e..02a11ebe062fe 100644 --- a/pandas/core/indexes/base.py +++ b/pandas/core/indexes/base.py @@ -3483,10 +3483,11 @@ def get_loc(self, key, method=None, tolerance=None): Compute indexer and mask for new index given the current index. The indexer should be then used as an input to ndarray.take to align the current data to the new index. - - Returns -1 for unmatched values, for further explanation see the example - below. - + + .. note:: + Returns -1 for unmatched values, for further explanation see the example + below. + Parameters ---------- target : %(target_klass)s From 229bb98e1fd3f816e59e5551934e44bf1777e463 Mon Sep 17 00:00:00 2001 From: DhruvBShetty Date: Mon, 1 Nov 2021 07:53:12 +0530 Subject: [PATCH 4/5] Added to notes section --- pandas/core/indexes/base.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/pandas/core/indexes/base.py b/pandas/core/indexes/base.py index 7f1b0aa9a1b99..b4fc42b586057 100644 --- a/pandas/core/indexes/base.py +++ b/pandas/core/indexes/base.py @@ -3545,11 +3545,7 @@ def get_loc(self, key, method=None, tolerance=None): Compute indexer and mask for new index given the current index. The indexer should be then used as an input to ndarray.take to align the current data to the new index. - - .. note:: - Returns -1 for unmatched values, for further explanation see the example - below. - + Parameters ---------- target : %(target_klass)s @@ -3580,6 +3576,12 @@ def get_loc(self, key, method=None, tolerance=None): positions matches the corresponding target values. Missing values in the target are marked by -1. %(raises_section)s + + Notes + ----- + Returns -1 for unmatched values, for further explanation see the example + below. + Examples -------- >>> index = pd.Index(['c', 'a', 'b']) From 9b4da48d60441744ba6cb698e5be6570f6e8a9b5 Mon Sep 17 00:00:00 2001 From: DhruvBShetty Date: Mon, 1 Nov 2021 16:23:29 +0530 Subject: [PATCH 5/5] removed blank line --- pandas/core/indexes/base.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pandas/core/indexes/base.py b/pandas/core/indexes/base.py index b4fc42b586057..4dc9c48dac2a4 100644 --- a/pandas/core/indexes/base.py +++ b/pandas/core/indexes/base.py @@ -3576,11 +3576,10 @@ def get_loc(self, key, method=None, tolerance=None): positions matches the corresponding target values. Missing values in the target are marked by -1. %(raises_section)s - Notes ----- - Returns -1 for unmatched values, for further explanation see the example - below. + Returns -1 for unmatched values, for further explanation see the + example below. Examples --------