final Index.join(other, *, how='left', level=None, return_indexers=False, sort=False)[source]#

Compute join_index and indexers to conform data structures to the new index.


The other index on which join is performed.

how{‘left’, ‘right’, ‘inner’, ‘outer’}
levelint or level name, default None

It is either the integer position or the name of the level.

return_indexersbool, default False

Whether to return the indexers or not for both the index objects.

sortbool, 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).

join_index, (left_indexer, right_indexer)

The new index.

See also


Join columns with other DataFrame either on index or on a key.


Merge DataFrame or named Series objects with a database-style join.


>>> idx1 = pd.Index([1, 2, 3])
>>> 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]))