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 « TimedeltaIndex »

Informations générales

Héritage

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

Définition

class TimedeltaIndex(DatetimeTimedeltaMixin):

help(TimedeltaIndex)

Immutable Index of timedelta64 data.

Represented internally as int64, and scalars returned Timedelta objects.

Parameters
----------
data : array-like (1-dimensional), optional
    Optional timedelta-like data to construct index with.
unit : {'D', 'h', 'm', 's', 'ms', 'us', 'ns'}, optional
    The unit of ``data``.

    .. deprecated:: 2.2.0
     Use ``pd.to_timedelta`` instead.

freq : str or pandas offset object, optional
    One of pandas date offset strings or corresponding objects. The string
    ``'infer'`` can be passed in order to set the frequency of the index as
    the inferred frequency upon creation.
dtype : numpy.dtype or str, default None
    Valid ``numpy`` dtypes are ``timedelta64[ns]``, ``timedelta64[us]``,
    ``timedelta64[ms]``, and ``timedelta64[s]``.
copy : bool
    Make a copy of input array.
name : object
    Name to be stored in the index.

Attributes
----------
days
seconds
microseconds
nanoseconds
components
inferred_freq

Methods
-------
to_pytimedelta
to_series
round
floor
ceil
to_frame
mean

See Also
--------
Index : The base pandas Index type.
Timedelta : Represents a duration between two dates or times.
DatetimeIndex : Index of datetime64 data.
PeriodIndex : Index of Period data.
timedelta_range : Create a fixed-frequency TimedeltaIndex.

Notes
-----
To learn more about the frequency strings, please see `this link
<https://pandas.pydata.org/pandas-docs/stable/user_guide/timeseries.html#offset-aliases>`__.

Examples
--------
>>> pd.TimedeltaIndex(['0 days', '1 days', '2 days', '3 days', '4 days'])
TimedeltaIndex(['0 days', '1 days', '2 days', '3 days', '4 days'],
               dtype='timedelta64[ns]', freq=None)

We can also let pandas infer the frequency when possible.

>>> pd.TimedeltaIndex(np.arange(5) * 24 * 3600 * 1e9, freq='infer')
TimedeltaIndex(['0 days', '1 days', '2 days', '3 days', '4 days'],
               dtype='timedelta64[ns]', freq='D')

Constructeur(s)

Signature du constructeur Description
__new__(cls, data=None, unit=<no_default>, freq=<no_default>, closed=<no_default>, dtype=None, copy: 'bool' = False, name=None)
__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>
inferred_freq<pandas._libs.properties.CachedProperty object at 0x0000020D9B4B7AC0>
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 DatetimeTimedeltaMixin

inferred_type

Liste des propriétés

Nom de la propriétéDescription
asi8
components
days
empty
freq
freqstr
has_duplicates
inferred_type
is_monotonic_decreasing
is_monotonic_increasing
microseconds
name
names
nanoseconds
nbytes
ndim
nlevels
seconds
shape
size
T
unit
values

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
get_loc(self, key)

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

__init_subclass__, __subclasshook__, as_unit, delete, insert, shift, take

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

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, asof_locs, astype, copy, 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, 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, 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 ? Mise en oeuvre d'IHM
avec Qt et PySide6
Voir le programme détaillé