On this page
pandas.Index.union
Index.union(other, sort=None)[source]-
Form the union of two Index objects.
Parameters: -
other : Index or array-like -
sort : bool or None, default None -
Whether to sort the resulting Index.
- None : Sort the result, except when
selfandotherare equal.selforotherhas length 0.- Some values in
selforothercannot be compared. A RuntimeWarning is issued in this case.
- False : do not sort the result.
New in version 0.24.0.
Changed in version 0.24.1: Changed the default value from
TruetoNone(without change in behaviour). - None : Sort the result, except when
Returns: -
union : Index
Examples
>>> idx1 = pd.Index([1, 2, 3, 4]) >>> idx2 = pd.Index([3, 4, 5, 6]) >>> idx1.union(idx2) Int64Index([1, 2, 3, 4, 5, 6], dtype='int64') -
© 2008–2012, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
Licensed under the 3-clause BSD License.
https://pandas.pydata.org/pandas-docs/version/0.24.2/reference/api/pandas.Index.union.html