hipdf.MultiIndex.from_tuples

hipdf.MultiIndex.from_tuples#

20 min read time

Applies to Linux

classmethod MultiIndex.from_tuples(tuples, names=None)#

Convert list of tuples to MultiIndex.

Parameters#

tupleslist / sequence of tuple-likes

Each tuple is the index of one row/column.

nameslist / sequence of str, optional

Names for the levels in the index.

Returns#

MultiIndex

See Also#

MultiIndex.from_productMake a MultiIndex from cartesian product

of iterables.

MultiIndex.from_frame : Make a MultiIndex from a DataFrame.

Examples#

>>> tuples = [(1, 'red'), (1, 'blue'),
...           (2, 'red'), (2, 'blue')]
>>> cudf.MultiIndex.from_tuples(tuples, names=('number', 'color'))
MultiIndex([(1,  'red'),
            (1, 'blue'),
            (2,  'red'),
            (2, 'blue')],
           names=['number', 'color'])