Participer au site avec un Tip
Rechercher
 

Améliorations / Corrections

Vous avez des améliorations (ou des corrections) à proposer pour ce document : je vous remerçie par avance de m'en faire part, cela m'aide à améliorer le site.

Emplacement :

Description des améliorations :

Module « pandas »

Classe « MultiIndex »

Informations générales

Héritage

builtins.object
    DirNamesMixin
        PandasObject
builtins.object
    OpsMixin
        IndexOpsMixin
            Index
                MultiIndex

Définition

class MultiIndex(Index):

Description [extrait de MultiIndex.__doc__]

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

    Parameters
    ----------
    levels : sequence of arrays
        The unique labels for each level.
    codes : sequence of arrays
        Integers for each level designating which label at each location.

        .. versionadded:: 0.24.0
    sortorder : optional int
        Level of sortedness (must be lexicographically sorted by that
        level).
    names : optional sequence of objects
        Names for each of the index levels. (name is accepted for compat).
    copy : bool, default False
        Copy the meta-data.
    verify_integrity : bool, default True
        Check that the levels/codes are consistent and valid.

    Attributes
    ----------
    names
    levels
    codes
    nlevels
    levshape

    Methods
    -------
    from_arrays
    from_tuples
    from_product
    from_frame
    set_levels
    set_codes
    to_frame
    to_flat_index
    is_lexsorted
    sortlevel
    droplevel
    swaplevel
    reorder_levels
    remove_unused_levels
    get_locs

    See Also
    --------
    MultiIndex.from_arrays  : Convert list of arrays to MultiIndex.
    MultiIndex.from_product : Create a MultiIndex from the cartesian product
                              of iterables.
    MultiIndex.from_tuples  : Convert list of tuples to a MultiIndex.
    MultiIndex.from_frame   : Make a MultiIndex from a DataFrame.
    Index : The base pandas Index type.

    Notes
    -----
    See the `user guide
    <https://pandas.pydata.org/pandas-docs/stable/user_guide/advanced.html>`_
    for more.

    Examples
    --------
    A new ``MultiIndex`` is typically constructed using one of the helper
    methods :meth:`MultiIndex.from_arrays`, :meth:`MultiIndex.from_product`
    and :meth:`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.
    

Constructeur(s)

Signature du constructeur Description
__new__(cls, levels=None, codes=None, sortorder=None, names=None, dtype=None, copy=False, name=None, verify_integrity: bool = True)

Liste des attributs statiques

Nom de l'attribut Valeur
dtype<pandas._libs.properties.CachedProperty object at 0x7f504b717780>
hasnans<pandas._libs.properties.CachedProperty object at 0x7f504bd34d40>
inferred_type<pandas._libs.properties.CachedProperty object at 0x7f504b717a40>
is_all_dates<pandas._libs.properties.CachedProperty object at 0x7f504bd34c40>
is_monotonic_decreasing<pandas._libs.properties.CachedProperty object at 0x7f504b717b80>
is_monotonic_increasing<pandas._libs.properties.CachedProperty object at 0x7f504b717b00>
is_unique<pandas._libs.properties.CachedProperty object at 0x7f504bd34880>
levels<pandas._libs.properties.CachedProperty object at 0x7f504b7175c0>
lexsort_depth<pandas._libs.properties.CachedProperty object at 0x7f504b717cc0>
nbytes<pandas._libs.properties.CachedProperty object at 0x7f504b7178c0>

Attributs statiques hérités de la classe Index

array

Liste des propriétés

Nom de la propriétéDescription
array
asi8
codes
empty
has_duplicates
is_monotonic
levshape
name
names
ndim
nlevels
shape
size
T
values

Propriétés héritées de la classe Index

is_monotonic_decreasing, is_monotonic_increasing, nbytes

Propriétés héritées de la classe IndexOpsMixin

dtype, is_unique

Liste des opérateurs

Signature de l'opérateur Description
__contains__(self, key: Any) -> bool
__getitem__(self, key)

Opérateurs hérités de la classe Index

__and__, __iadd__, __inv__, __neg__, __or__, __pos__, __setitem__, __xor__

Opérateurs hérités de la classe OpsMixin

__add__, __eq__, __floordiv__, __ge__, __gt__, __le__, __lt__, __mod__, __mul__, __ne__, __pow__, __radd__, __rand__, __rfloordiv__, __rmod__, __rmul__, __ror__, __rpow__, __rsub__, __rtruediv__, __rxor__, __sub__, __truediv__

Liste des méthodes

Toutes les méthodes Méthodes d'instance Méthodes statiques Méthodes dépréciées
Signature de la méthodeDescription
__array__(self, dtype=None) -> numpy.ndarray the array interface, return my values [extrait de __array__.__doc__]
__len__(self) -> int
__reduce__(self) Necessary for making this object picklable [extrait de __reduce__.__doc__]
append(self, other)
argsort(self, *args, **kwargs) -> numpy.ndarray
astype(self, dtype, copy=True)
copy(self, names=None, dtype=None, levels=None, codes=None, deep=False, name=None)
delete(self, loc)
difference(self, other, sort=None)
drop(self, codes, level=None, errors='raise')
dropna(self, how='any')
duplicated(self, keep='first')
equal_levels(self, other) -> bool
equals(self, other: object) -> bool
fillna(self, value=None, downcast=None)
format(self, name: Optional[bool] = None, formatter: Optional[Callable] = None, na_rep: Optional[str] = None, names: bool = False, space: int = 2, sparsify=None, adjoin: bool = True) -> List
from_arrays(arrays, sortorder=None, names=<object object at 0x7f5051439e10>) -> 'MultiIndex'
from_frame(df, sortorder=None, names=None)
from_product(iterables, sortorder=None, names=<object object at 0x7f5051439e10>)
from_tuples(tuples, sortorder: Optional[int] = None, names: Optional[Sequence[Optional[Hashable]]] = None)
get_indexer(self, target, method=None, limit=None, tolerance=None)
get_level_values(self, level)
get_loc(self, key, method=None)
get_loc_level(self, key, level=0, drop_level: bool = True)
get_locs(self, seq)
get_slice_bound(self, label: Union[Hashable, Sequence[Hashable]], side: str, kind: str) -> int
insert(self, loc: int, item)
intersection(self, other, sort=False)
is_lexsorted(self) -> bool
isin(self, values, level=None)
memory_usage(self, deep: bool = False) -> int
reindex(self, target, method=None, level=None, limit=None, tolerance=None)
remove_unused_levels(self)
reorder_levels(self, order)
repeat(self, repeats, axis=None)
set_codes(self, codes, level=None, inplace=None, verify_integrity=True)
set_levels(self, levels, level=None, inplace=None, verify_integrity=True)
slice_locs(self, start=None, end=None, step=None, kind=None)
sortlevel(self, level=0, ascending=True, sort_remaining=True)
swaplevel(self, i=-2, j=-1)
symmetric_difference(self, other, result_name=None, sort=None)
take(self, indices, axis=0, allow_fill=True, fill_value=None, **kwargs)
to_flat_index(self)
to_frame(self, index=True, name=None)
truncate(self, before=None, after=None)
union(self, other, sort=None)
unique(self, level=None)
view(self, cls=None) this is defined as a copy with the same identity [extrait de view.__doc__]
where(self, cond, other=None)

Méthodes héritées de la classe Index

__abs__, __array_wrap__, __bool__, __copy__, __deepcopy__, __hash__, __init_subclass__, __nonzero__, __repr__, __subclasshook__, all, any, asof, asof_locs, drop_duplicates, droplevel, get_indexer_for, get_indexer_non_unique, get_value, groupby, holds_integer, identical, is_, is_boolean, is_categorical, is_floating, is_integer, is_interval, is_mixed, is_numeric, is_object, is_type_compatible, isna, isnull, join, map, notna, notnull, putmask, ravel, rename, set_names, set_value, shift, slice_indexer, sort, sort_values, to_native_types, to_series

Méthodes héritées de la classe PandasObject

__sizeof__

Méthodes héritées de la classe DirNamesMixin

__dir__

Méthodes héritées de la classe IndexOpsMixin

__iter__, argmax, argmin, factorize, item, max, min, nunique, searchsorted, to_list, to_numpy, tolist, transpose, value_counts

Méthodes héritées de la classe OpsMixin

__divmod__, __rdivmod__

Méthodes héritées de la classe object

__delattr__, __format__, __getattribute__, __reduce_ex__, __setattr__, __str__