From bc52dd3fb7100a090433ff8ab8019777d8198326 Mon Sep 17 00:00:00 2001 From: tuhinsharma121 Date: Sat, 4 May 2024 09:58:48 +0530 Subject: [PATCH 1/4] DOC: add PR07,RT03,SA01 for pandas.Index.join --- pandas/core/indexes/base.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pandas/core/indexes/base.py b/pandas/core/indexes/base.py index e93db22906b39..22c0df9b380c4 100644 --- a/pandas/core/indexes/base.py +++ b/pandas/core/indexes/base.py @@ -4299,9 +4299,12 @@ def join( Parameters ---------- other : Index + The other index on which join is performed. how : {'left', 'right', 'inner', 'outer'} level : int or level name, default None + It is either the integer position or the name of the level. return_indexers : bool, default False + Whether to return the indexers or not for both the index objects. sort : bool, default False Sort the join keys lexicographically in the result Index. If False, the order of the join keys depends on the join type (how keyword). @@ -4309,6 +4312,14 @@ def join( Returns ------- join_index, (left_indexer, right_indexer) + The new index. + + See Also + -------- + DataFrame.join : Join columns with `other` DataFrame either on index + or on a key. + DataFrame.merge : Merge DataFrame or named Series objects with a + database-style join. Examples -------- @@ -4316,6 +4327,8 @@ def join( >>> idx2 = pd.Index([4, 5, 6]) >>> idx1.join(idx2, how="outer") Index([1, 2, 3, 4, 5, 6], dtype='int64') + >>> idx1.join(other=idx2, how="outer", return_indexers=True) + Index([1, 2, 3, 4, 5, 6], dtype='int64'), array([ 0, 1, 2, -1, -1, -1]), array([-1, -1, -1, 0, 1, 2]) """ other = ensure_index(other) sort = sort or how == "outer" From f9af4d76cae6483a33d1c02d1110f6ac314c2c8a Mon Sep 17 00:00:00 2001 From: tuhinsharma121 Date: Sat, 4 May 2024 09:59:23 +0530 Subject: [PATCH 2/4] DOC: remove PR07,RT03,SA01 for pandas.Index.join --- ci/code_checks.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/ci/code_checks.sh b/ci/code_checks.sh index 936e3664cfe93..af1c379caa5a5 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.join PR07,RT03,SA01" \ -i "pandas.Index.names GL08" \ -i "pandas.Index.ravel PR01,RT03" \ -i "pandas.Index.str PR01,SA01" \ From aa39d36653cc95f09d1671bac2c36bd03c2ed3e3 Mon Sep 17 00:00:00 2001 From: tuhinsharma121 Date: Sat, 4 May 2024 10:10:36 +0530 Subject: [PATCH 3/4] DOC: add PR07,RT03,SA01 for pandas.Index.join --- 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 22c0df9b380c4..be57bca8bb9fc 100644 --- a/pandas/core/indexes/base.py +++ b/pandas/core/indexes/base.py @@ -4328,7 +4328,8 @@ def join( >>> idx1.join(idx2, how="outer") Index([1, 2, 3, 4, 5, 6], dtype='int64') >>> idx1.join(other=idx2, how="outer", return_indexers=True) - Index([1, 2, 3, 4, 5, 6], dtype='int64'), array([ 0, 1, 2, -1, -1, -1]), array([-1, -1, -1, 0, 1, 2]) + Index([1, 2, 3, 4, 5, 6], dtype='int64'), + array([ 0, 1, 2, -1, -1, -1]), array([-1, -1, -1, 0, 1, 2]) """ other = ensure_index(other) sort = sort or how == "outer" From 49483cfc73a8932e22cf39fdc6d04e7da6ac67cf Mon Sep 17 00:00:00 2001 From: tuhinsharma121 Date: Mon, 6 May 2024 21:13:51 +0530 Subject: [PATCH 4/4] DOC: fix example output --- pandas/core/indexes/base.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandas/core/indexes/base.py b/pandas/core/indexes/base.py index ca6e1bf5c119c..8ae087ac24741 100644 --- a/pandas/core/indexes/base.py +++ b/pandas/core/indexes/base.py @@ -4345,8 +4345,8 @@ def join( >>> idx1.join(idx2, how="outer") Index([1, 2, 3, 4, 5, 6], dtype='int64') >>> idx1.join(other=idx2, how="outer", return_indexers=True) - Index([1, 2, 3, 4, 5, 6], dtype='int64'), - array([ 0, 1, 2, -1, -1, -1]), array([-1, -1, -1, 0, 1, 2]) + (Index([1, 2, 3, 4, 5, 6], dtype='int64'), + array([ 0, 1, 2, -1, -1, -1]), array([-1, -1, -1, 0, 1, 2])) """ other = ensure_index(other) sort = sort or how == "outer"