Python is a great language for doing data analysis, primarily because of the fantastic ecosystem of data-centric python packages. Pandas is one of those packages and makes importing and analyzing data much easier.
Index.union() function form the union of two Index objects and sorts if possible. The function follows behaves like a standard set union operation. The function can also find the union of categorical data.
other : Index or array-like
Returns : union : Index
Example #1: Use
Index.union() function to find the union of two indexes.
Let’s find the union of these two indexes
The function has found the union of these two indexes.
Example #2: Use
Index.union() function to perform set union operation on the given two indexes. Index lables are of string type.
Let’s find the union of these two indexes.
The function has returned a new index that contains the result of the set union of the idx1 and idx2.
- Python | pandas.map()
- Python | Pandas dataframe.add()
- Python | Pandas Index.contains()
- Python | Pandas Series.ix
- Python | Pandas Series.loc
- Python | Pandas Series.dt.day
- Python | Pandas Series.dt.second
- Python | Pandas Series.mod()
- Python | Pandas Dataframe.at[ ]
- Python | Pandas Dataframe.iat[ ]
- Python | Pandas DataFrame.abs()
- Python | Pandas dataframe.all()
- Python | Pandas Series.agg()
- Python | Pandas dataframe.mean()
- Python | Pandas dataframe.max()
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.