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.html below:

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

pandas.MultiIndex#
class pandas.MultiIndex(levels=None, codes=None, sortorder=None, names=None, copy=False, name=None, verify_integrity=True)[source]#

A multi-level, or hierarchical, index object for pandas objects.

Parameters:
levelssequence of arrays

The unique labels for each level.

codessequence of arrays

Integers for each level designating which label at each location.

sortorderoptional int

Level of sortedness (must be lexicographically sorted by that level).

namesoptional sequence of objects

Names for each of the index levels. (name is accepted for compat).

copybool, default False

Copy the meta-data.

nameLabel

Kept for compatibility with 1-dimensional Index. Should not be used.

verify_integritybool, default True

Check that the levels/codes are consistent and valid.

Attributes

Methods

Notes

See the user guide for more.

Examples

A new MultiIndex is typically constructed using one of the helper methods MultiIndex.from_arrays(), MultiIndex.from_product() and MultiIndex.from_tuples(). For example (using .from_arrays):

>>> arrays = [[1, 1, 2, 2], ["red", "blue", "red", "blue"]]
>>> pd.MultiIndex.from_arrays(arrays, names=("number", "color"))
MultiIndex([(1,  'red'),
            (1, 'blue'),
            (2,  'red'),
            (2, 'blue')],
           names=['number', 'color'])

See further examples for how to construct a MultiIndex in the doc strings of the mentioned helper methods.


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