pandas.MultiIndex.append#

MultiIndex.append(other)[source]#

Append a collection of Index options together.

The append method is used to combine multiple Index objects into a single Index. This is particularly useful when dealing with multi-level indexing (MultiIndex) where you might need to concatenate different levels of indices. The method handles the alignment of the levels and codes of the indices being appended to ensure consistency in the resulting MultiIndex.

Parameters:
otherIndex or list/tuple of indices

Index or list/tuple of Index objects to be appended.

Returns:
Index

The combined index.

See also

MultiIndex

A multi-level, or hierarchical, index object for pandas objects.

Index.append

Append a collection of Index options together.

concat

Concatenate pandas objects along a particular axis.

Examples

>>> mi = pd.MultiIndex.from_arrays([["a"], ["b"]])
>>> mi
MultiIndex([('a', 'b')],
           )
>>> mi.append(mi)
MultiIndex([('a', 'b'), ('a', 'b')],
           )