Vous êtes un professionnel et vous avez besoin d'une formation ?
RAG (Retrieval-Augmented Generation)et Fine Tuning d'un LLM
Voir le programme détaillé
Module « pandas »
Classe « Index »
Informations générales
Héritage
builtins.object
DirNamesMixin
PandasObject
builtins.object
OpsMixin
IndexOpsMixin
Index
Définition
class Index (IndexOpsMixin, PandasObject):
help(Index )
Immutable sequence used for indexing and alignment.
The basic object storing axis labels for all pandas objects.
.. versionchanged:: 2.0.0
Index can hold all numpy numeric dtypes (except float16). Previously only
int64/uint64/float64 dtypes were accepted.
Parameters
----------
data : array-like (1-dimensional)
dtype : str, numpy.dtype, or ExtensionDtype, optional
Data type for the output Index. If not specified, this will be
inferred from `data`.
See the :ref:`user guide <basics.dtypes>` for more usages.
copy : bool, default False
Copy input data.
name : object
Name to be stored in the index.
tupleize_cols : bool (default: True)
When True, attempt to create a MultiIndex if possible.
See Also
--------
RangeIndex : Index implementing a monotonic integer range.
CategoricalIndex : Index of :class:`Categorical` s.
MultiIndex : A multi-level, or hierarchical Index.
IntervalIndex : An Index of :class:`Interval` s.
DatetimeIndex : Index of datetime64 data.
TimedeltaIndex : Index of timedelta64 data.
PeriodIndex : Index of Period data.
Notes
-----
An Index instance can **only** contain hashable objects.
An Index instance *can not* hold numpy float16 dtype.
Examples
--------
>>> pd.Index([1, 2, 3])
Index([1, 2, 3], dtype='int64')
>>> pd.Index(list('abc'))
Index(['a', 'b', 'c'], dtype='object')
>>> pd.Index([1, 2, 3], dtype="uint8")
Index([1, 2, 3], dtype='uint8')
Constructeur(s)
Liste des attributs statiques
array <pandas._libs.properties.CachedProperty object at 0x0000020D9B489680>
dtype <pandas._libs.properties.CachedProperty object at 0x0000020D9B47BF80>
hasnans <pandas._libs.properties.CachedProperty object at 0x0000020D9B488B40>
inferred_type <pandas._libs.properties.CachedProperty object at 0x0000020D9B4889C0>
is_unique <pandas._libs.properties.CachedProperty object at 0x0000020D9B4886C0>
Liste des propriétés
empty
has_duplicates
is_monotonic_decreasing
is_monotonic_increasing
name
names
nbytes
ndim
nlevels
shape
size
T
values
Propriétés héritées de la classe IndexOpsMixin
array, dtype, is_unique
Opérateurs hérités de la classe OpsMixin
__add__, __and__, __eq__, __floordiv__, __ge__, __gt__, __le__, __lt__, __mod__, __mul__, __ne__, __or__, __pow__, __radd__, __rand__, __rfloordiv__, __rmod__, __rmul__, __ror__, __rpow__, __rsub__, __rtruediv__, __rxor__, __sub__, __truediv__, __xor__
Liste des méthodes
Toutes les méthodes
Méthodes d'instance
Méthodes statiques
Méthodes dépréciées
__abs__(self) -> 'Index'
__array__(self, dtype=None, copy=None) -> 'np.ndarray'
__array_ufunc__(self, ufunc: 'np.ufunc', method: 'str_t', *inputs, **kwargs)
__array_wrap__(self, result, context=None, return_scalar=False)
__bool__(self) -> 'NoReturn'
__copy__(self, **kwargs) -> 'Self'
__deepcopy__(self, memo=None) -> 'Self'
__len__(self) -> 'int'
__nonzero__(self) -> 'NoReturn'
__reduce__(self)
__repr__(self) -> 'str_t'
all(self, *args, **kwargs)
any(self, *args, **kwargs)
append(self, other: 'Index | Sequence[Index]') -> 'Index'
argmax(self, axis=None, skipna: 'bool' = True, *args, **kwargs) -> 'int'
argmin(self, axis=None, skipna: 'bool' = True, *args, **kwargs) -> 'int'
argsort(self, *args, **kwargs) -> 'npt.NDArray[np.intp]'
asof(self, label)
asof_locs(self, where: 'Index', mask: 'npt.NDArray[np.bool_]') -> 'npt.NDArray[np.intp]'
astype(self, dtype, copy: 'bool' = True)
copy(self, name: 'Hashable | None' = None, deep: 'bool' = False) -> 'Self'
delete(self, loc) -> 'Self'
diff(self, periods: 'int' = 1) -> 'Index'
difference(self, other, sort=None)
drop(self, labels: 'Index | np.ndarray | Iterable[Hashable]', errors: 'IgnoreRaise' = 'raise') -> 'Index'
drop_duplicates(self, *, keep: 'DropKeep' = 'first') -> 'Self'
droplevel(self, level: 'IndexLabel' = 0)
dropna(self, how: 'AnyAll' = 'any') -> 'Self'
duplicated(self, keep: 'DropKeep' = 'first') -> 'npt.NDArray[np.bool_]'
equals(self, other: 'Any') -> 'bool'
fillna(self, value=None, downcast=<no_default>)
format(self, name: 'bool' = False, formatter: 'Callable | None' = None, na_rep: 'str_t' = 'NaN') -> 'list[str_t]'
get_indexer(self, target, method: 'ReindexMethod | None' = None, limit: 'int | None' = None, tolerance=None) -> 'npt.NDArray[np.intp]'
get_indexer_for(self, target) -> 'npt.NDArray[np.intp]'
get_indexer_non_unique(self, target) -> 'tuple[npt.NDArray[np.intp], npt.NDArray[np.intp]]'
get_level_values(self, level) -> 'Index'
get_loc(self, key)
get_slice_bound(self, label, side: "Literal['left', 'right']") -> 'int'
groupby(self, values) -> 'PrettyDict[Hashable, np.ndarray]'
holds_integer(self) -> 'bool'
identical(self, other) -> 'bool'
infer_objects(self, copy: 'bool' = True) -> 'Index'
insert(self, loc: 'int', item) -> 'Index'
intersection(self, other, sort: 'bool' = False)
is_(self, other) -> 'bool'
is_boolean(self) -> 'bool'
is_categorical(self) -> 'bool'
is_floating(self) -> 'bool'
is_integer(self) -> 'bool'
is_interval(self) -> 'bool'
is_numeric(self) -> 'bool'
is_object(self) -> 'bool'
isin(self, values, level=None) -> 'npt.NDArray[np.bool_]'
isna(self) -> 'npt.NDArray[np.bool_]'
isnull(self) -> 'npt.NDArray[np.bool_]'
join(self, other: 'Index', *, how: 'JoinHow' = 'left', level: 'Level | None' = None, return_indexers: 'bool' = False, sort: 'bool' = False) -> 'Index | tuple[Index, npt.NDArray[np.intp] | None, npt.NDArray[np.intp] | None]'
map(self, mapper, na_action: "Literal['ignore'] | None" = None)
max(self, axis=None, skipna: 'bool' = True, *args, **kwargs)
memory_usage(self, deep: 'bool' = False) -> 'int'
min(self, axis=None, skipna: 'bool' = True, *args, **kwargs)
notna(self) -> 'npt.NDArray[np.bool_]'
notnull(self) -> 'npt.NDArray[np.bool_]'
putmask(self, mask, value) -> 'Index'
ravel(self, order: 'str_t' = 'C') -> 'Self'
reindex(self, target, method: 'ReindexMethod | None' = None, level=None, limit: 'int | None' = None, tolerance: 'float | None' = None) -> 'tuple[Index, npt.NDArray[np.intp] | None]'
rename(self, name, *, inplace: 'bool' = False) -> 'Self | None'
repeat(self, repeats, axis: 'None' = None) -> 'Self'
round(self, decimals: 'int' = 0) -> 'Self'
set_names(self, names, *, level=None, inplace: 'bool' = False) -> 'Self | None'
shift(self, periods: 'int' = 1, freq=None)
slice_indexer(self, start: 'Hashable | None' = None, end: 'Hashable | None' = None, step: 'int | None' = None) -> 'slice'
slice_locs(self, start=None, end=None, step=None) -> 'tuple[int, int]'
sort(self, *args, **kwargs)
sort_values(self, *, return_indexer: 'bool' = False, ascending: 'bool' = True, na_position: 'NaPosition' = 'last', key: 'Callable | None' = None) -> 'Self | tuple[Self, np.ndarray]'
sortlevel(self, level=None, ascending: 'bool | list[bool]' = True, sort_remaining=None, na_position: 'NaPosition' = 'first')
symmetric_difference(self, other, result_name=None, sort=None)
take(self, indices, axis: 'Axis' = 0, allow_fill: 'bool' = True, fill_value=None, **kwargs) -> 'Self'
to_flat_index(self) -> 'Self'
to_frame(self, index: 'bool' = True, name: 'Hashable' = <no_default>) -> 'DataFrame'
to_series(self, index=None, name: 'Hashable | None' = None) -> 'Series'
union(self, other, sort=None)
unique(self, level: 'Hashable | None' = None) -> 'Self'
view(self, cls=None)
where(self, cond, other=None) -> 'Index'
Méthodes héritées de la classe PandasObject
__init_subclass__, __sizeof__, __subclasshook__
Méthodes héritées de la classe DirNamesMixin
__dir__
Méthodes héritées de la classe IndexOpsMixin
__iter__, factorize, item, 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__ ,
__getstate__ ,
__hash__ ,
__reduce_ex__ ,
__setattr__ ,
__str__
Vous êtes un professionnel et vous avez besoin d'une formation ?
Coder avec une Intelligence Artificielle
Voir le programme détaillé
2025 © SARL Infini Software - Tous droits réservés
Mentions légales
Les informations présentes dans ce site vous sont fournies dans le but de vous aider à acquérir les compétences nécessaires à
l'utilisation des langages ou des technologies considérés. Infini Software ne pourra nullement être tenu responsable de l'utilisation
des informations présentes dans ce site.
De plus, si vous remarquez des erreurs ou des oublis dans ce document, n'hésitez surtout pas à nous le signaler en envoyant un mail
à l'adresse : .
Les autres marques et les noms de produits cités dans ces documents sont la propriété de leurs éditeurs respectifs.
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 :