pandas.MultiIndex.append — pandas 3.0.0.dev0+2099.g3832e85779 documentation (original) (raw)
MultiIndex.append(other)[source]#
Append a collection of Index options together.
The append method is used to combine multiple Index objects into a singleIndex. 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
A multi-level, or hierarchical, index object for pandas objects.
Append a collection of Index options together.
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')], )