xarray.CFTimeIndex.join#
- CFTimeIndex.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.
- Parameters:
other (
Index) – The other index on which join is performed.how (
{'left', 'right', 'inner', 'outer'})level (
intorlevel name, defaultNone) – It is either the integer position or the name of the level.return_indexers (
bool, defaultFalse) – Whether to return the indexers or not for both the index objects.sort (
bool, defaultFalse) – Sort the join keys lexicographically in the result Index. If False, the order of the join keys depends on the join type (how keyword).
- Returns:
join_index,(left_indexer,right_indexer)– The new index.
See also
DataFrame.joinJoin columns with other DataFrame either on index or on a key.
DataFrame.mergeMerge DataFrame or named Series objects with a database-style join.
Examples
>>> 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]))