-
classmethod
MultiIndex.from_product(iterables, sortorder=None,names=<object object>)
Make a MultiIndex from the cartesian product of multiple iterables.
-
Parameters
-
iterable : list/sequence of iterables
Each iterable has unique for each level of the index
-
sortorder : int or None
Level of sortedness (must be lexicographically sorted by that level)
-
names : list / sequence of str, optional
Names for the levels in the index.
Changed in version 1.0.0 : If not explicitly provided, names will be inferred from the elments of itrables if an element has a name attribute
-
-
Example
>>> numbers = [1,2,3] >>> colors = ['green','purple'
理解pd.MultiIndex.from_product
最新推荐文章于 2024-08-08 16:06:13 发布