Javatpoint Logo
Javatpoint Logo

Multiple Index

Multiple indexing is defined as a very essential indexing because it deals with the data analysis and manipulation, especially for working with higher dimensional data. It also enables to store and manipulate data with the arbitrary number of dimensions in lower dimensional data structures like Series and DataFrame.

It is the hierarchical analogue of the standard index object which is used to store the axis labels in pandas objects. It can also be defined as an array of tuples where each tuple is unique. It can be created from a list of arrays, an array of tuples, and a crossed set of iterables.

Example:

Output:

 [('it', 'one'),
 ('it', 'two'),
 ('of', 'one'),
 ('of', 'two'),
 ('for', 'one'),
 ('for', 'two'),
 ('then', 'one'),
 ('then', 'two')]

Example2:

Output:

MultiIndex([('bar', 'one'),
 [('it', 'one'),
 ('it', 'two'),
 ('of', 'one'),
 ('of', 'two'),
 ('for', 'one'),
 ('for', 'two'),
 ('then', 'one'),
 ('then', 'two')]
 names=['first', 'second'])

Example3:

Output:

MultiIndex(levels=[[nan, None, NaT, 128, 2]],
           codes=[[0, -1, 1, 2, 3, 4]])

Next TopicPandas Reindex




Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA