databricks.koalas.MultiIndex.from_tuples¶
-
static
MultiIndex.
from_tuples
(tuples, sortorder=None, names=None) → databricks.koalas.indexes.multi.MultiIndex[source]¶ Convert list of tuples to MultiIndex.
- Parameters
- tupleslist / sequence of tuple-likes
Each tuple is the index of one row/column.
- sortorderint or None
Level of sortedness (must be lexicographically sorted by that level).
- nameslist / sequence of str, optional
Names for the levels in the index.
- Returns
- indexMultiIndex
Examples
>>> tuples = [(1, 'red'), (1, 'blue'), ... (2, 'red'), (2, 'blue')] >>> ks.MultiIndex.from_tuples(tuples, names=('number', 'color')) MultiIndex([(1, 'red'), (1, 'blue'), (2, 'red'), (2, 'blue')], names=['number', 'color'])