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 :

Vous êtes un professionnel et vous avez besoin d'une formation ? Sensibilisation à
l'Intelligence Artificielle
Voir le programme détaillé
Module « pandas »

Classe « PeriodIndex »

Informations générales

Héritage

                builtins.object
                    ABC
builtins.object
    DirNamesMixin
        PandasObject
builtins.object
    OpsMixin
        IndexOpsMixin
            Index
                ExtensionIndex
                    NDArrayBackedExtensionIndex
                        DatetimeIndexOpsMixin
                            PeriodIndex

Définition

class PeriodIndex(DatetimeIndexOpsMixin):

help(PeriodIndex)

Immutable ndarray holding ordinal values indicating regular periods in time.

Index keys are boxed to Period objects which carries the metadata (eg,
frequency information).

Parameters
----------
data : array-like (1d int np.ndarray or PeriodArray), optional
    Optional period-like data to construct index with.
copy : bool
    Make a copy of input ndarray.
freq : str or period object, optional
    One of pandas period strings or corresponding objects.
year : int, array, or Series, default None

    .. deprecated:: 2.2.0
       Use PeriodIndex.from_fields instead.
month : int, array, or Series, default None

    .. deprecated:: 2.2.0
       Use PeriodIndex.from_fields instead.
quarter : int, array, or Series, default None

    .. deprecated:: 2.2.0
       Use PeriodIndex.from_fields instead.
day : int, array, or Series, default None

    .. deprecated:: 2.2.0
       Use PeriodIndex.from_fields instead.
hour : int, array, or Series, default None

    .. deprecated:: 2.2.0
       Use PeriodIndex.from_fields instead.
minute : int, array, or Series, default None

    .. deprecated:: 2.2.0
       Use PeriodIndex.from_fields instead.
second : int, array, or Series, default None

    .. deprecated:: 2.2.0
       Use PeriodIndex.from_fields instead.
dtype : str or PeriodDtype, default None

Attributes
----------
day
dayofweek
day_of_week
dayofyear
day_of_year
days_in_month
daysinmonth
end_time
freq
freqstr
hour
is_leap_year
minute
month
quarter
qyear
second
start_time
week
weekday
weekofyear
year

Methods
-------
asfreq
strftime
to_timestamp
from_fields
from_ordinals

See Also
--------
Index : The base pandas Index type.
Period : Represents a period of time.
DatetimeIndex : Index with datetime64 data.
TimedeltaIndex : Index of timedelta64 data.
period_range : Create a fixed-frequency PeriodIndex.

Examples
--------
>>> idx = pd.PeriodIndex.from_fields(year=[2000, 2002], quarter=[1, 3])
>>> idx
PeriodIndex(['2000Q1', '2002Q3'], dtype='period[Q-DEC]')

Constructeur(s)

Signature du constructeur Description
__new__(cls, data=None, ordinal=None, freq=None, dtype: 'Dtype | None' = None, copy: 'bool' = False, name: 'Hashable | None' = None, **fields) -> 'Self'
__init__(self, /, *args, **kwargs) Initialize self. See help(type(self)) for accurate signature. [extrait de __init__.__doc__]

Liste des attributs statiques

Nom de l'attribut Valeur
array<pandas._libs.properties.CachedProperty object at 0x0000020D9B489680>
dtype<pandas._libs.properties.CachedProperty object at 0x0000020D9B47BF80>
hasnans<pandas._libs.properties.CachedProperty object at 0x0000020D9B4B7140>
is_unique<pandas._libs.properties.CachedProperty object at 0x0000020D9B4886C0>
resolution<pandas._libs.properties.CachedProperty object at 0x0000020D9B4B7100>

Attributs statiques hérités de la classe DatetimeIndexOpsMixin

inferred_type

Liste des propriétés

Nom de la propriétéDescription
asi8
day
day_of_week
day_of_year
dayofweek
dayofyear
days_in_month
daysinmonth
empty
end_time
freq
freqstr
has_duplicates
hour
inferred_type
is_full
is_leap_year
is_monotonic_decreasing
is_monotonic_increasing
minute
month
name
names
nbytes
ndim
nlevels
quarter
qyear
second
shape
size
start_time
T
values
week
weekday
weekofyear
year

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

array, dtype, is_unique

Liste des opérateurs

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

__contains__

Liste des opérateurs

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

__getitem__, __iadd__, __invert__, __neg__, __pos__, __setitem__

Liste des opérateurs

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
Signature de la méthodeDescription
asfreq(self, freq=None, how: 'str' = 'E') -> 'Self'
asof_locs(self, where: 'Index', mask: 'npt.NDArray[np.bool_]') -> 'np.ndarray'
from_fields(*, year=None, quarter=None, month=None, day=None, hour=None, minute=None, second=None, freq=None) -> 'Self'
from_ordinals(ordinals, *, freq, name=None) -> 'Self'
get_loc(self, key)
shift(self, periods: 'int' = 1, freq=None) -> 'Self'
to_timestamp(self, freq=None, how: 'str' = 'start') -> 'DatetimeIndex'

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

__init_subclass__, __subclasshook__, equals, format, mean

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

__abs__, __array__, __array_ufunc__, __array_wrap__, __bool__, __copy__, __deepcopy__, __len__, __nonzero__, __reduce__, __repr__, all, any, append, argmax, argmin, argsort, asof, astype, copy, delete, diff, difference, drop, drop_duplicates, droplevel, dropna, duplicated, fillna, get_indexer, get_indexer_for, get_indexer_non_unique, get_level_values, get_slice_bound, groupby, holds_integer, identical, infer_objects, insert, intersection, is_, is_boolean, is_categorical, is_floating, is_integer, is_interval, is_numeric, is_object, isin, isna, isnull, join, map, max, memory_usage, min, notna, notnull, putmask, ravel, reindex, rename, repeat, round, set_names, slice_indexer, slice_locs, sort, sort_values, sortlevel, symmetric_difference, take, to_flat_index, to_frame, to_series, union, unique, view, where

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__, 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 ? RAG (Retrieval-Augmented Generation)
et Fine Tuning d'un LLM
Voir le programme détaillé