![]() |
VOOZH | about |
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:
👁 ImageJoining 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:
👁 ImageExample 2:
This code is an example for all the given same name, but different values passed in a tuple.
Output:
👁 ImageExample 3:
This code gives a demo on multiple users given in nested list data structure.
Output:
👁 ImageExample 4:
This code explains the college data with respect to address passed in a nested list separated by '/' operator.