A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://pandas.pydata.org/docs/dev/user_guide/../reference/api/pandas.MultiIndex.from_product.html below:

pandas.MultiIndex.from_product — pandas 3.0.0.dev0+2231.g4f2aa4d2be documentation

pandas.MultiIndex.from_product#
classmethod MultiIndex.from_product(iterables, sortorder=None, names=<no_default>)[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. If not explicitly provided, names will be inferred from the elements of iterables if an element has a name attribute.

Returns:
MultiIndex

Examples

>>> numbers = [0, 1, 2]
>>> colors = ["green", "purple"]
>>> pd.MultiIndex.from_product([numbers, colors], names=["number", "color"])
MultiIndex([(0,  'green'),
            (0, 'purple'),
            (1,  'green'),
            (1, 'purple'),
            (2,  'green'),
            (2, 'purple')],
           names=['number', 'color'])

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4