pyspark.pandas.MultiIndex.from_product¶
- 
static 
MultiIndex.from_product(iterables: List[List], sortorder: Optional[int] = None, names: Optional[List[Union[Any, Tuple[Any, …]]]] = None) → pyspark.pandas.indexes.multi.MultiIndex[source]¶ Make a MultiIndex from the cartesian product of multiple iterables.
- Parameters
 - iterableslist / sequence of iterables
 Each iterable has unique labels for each level of the index.
- 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
 
See also
MultiIndex.from_arraysConvert list of arrays to MultiIndex.
MultiIndex.from_tuplesConvert list of tuples to MultiIndex.
Examples
>>> numbers = [0, 1, 2] >>> colors = ['green', 'purple'] >>> ps.MultiIndex.from_product([numbers, colors], ... names=['number', 'color']) MultiIndex([(0, 'green'), (0, 'purple'), (1, 'green'), (1, 'purple'), (2, 'green'), (2, 'purple')], names=['number', 'color'])