VOOZH about

URL: https://www.geeksforgeeks.org/python/concatenate-multiindex-into-single-index-in-pandas-series/

⇱ Concatenate multiIndex into single index in Pandas Series - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Concatenate multiIndex into single index in Pandas Series

Last Updated : 14 Sep, 2021

In this article, we will see how to concatenate multi-index to a single index in Pandas Series. Multi-index refers to having more than one index with the same name.

Create a sample series:

Output:

👁 Image

Joining two or more data is known as concatenation. Here we are going to concatenate the index using map function.

Syntax:

map(fun, iter)

  • fun: function
  • iter: iterations.

Below are various examples that depict how to concatenate multi-index into a single index in Series:

Example 1:

This code explains the joining of addresses into one based on multi-index.

Output:

👁 Image

Example 2:

This code is an example for all the given same name, but different values passed in a tuple.

Output:

👁 Image

Example 3: 

This code gives a demo on multiple users given in nested list data structure.

Output:

👁 Image

Example 4:

This code explains the college data with respect to address passed in a nested list separated by '/' operator.

Output:

👁 Image
Comment