DatetimeIndex ============= .. currentmodule:: pandasCore .. class:: DatetimeIndex Immutable ndarray-like of datetime64 data. Example ------- .. code-block:: python import pandasCore as pd # Create DatetimeIndex idx = pd.DatetimeIndex([1, 2, 3], name='my_index') print(len(idx)) # 3 Attributes ---------- .. list-table:: :widths: 25 60 15 :header-rows: 1 * - Attribute - Description - Example * - :attr:`~DatetimeIndex.day` - The day of the datetime - * - :attr:`~DatetimeIndex.day_of_week` - The day of the week with Monday=0, Sunday=6 - * - :attr:`~DatetimeIndex.day_of_year` - The ordinal day of the year - * - :attr:`~DatetimeIndex.dayofweek` - The day of the week with Monday=0, Sunday=6 - * - :attr:`~DatetimeIndex.dayofyear` - The ordinal day of the year - * - :attr:`~DatetimeIndex.dtype` - Return the dtype object of the underlying data - * - :attr:`~DatetimeIndex.empty` - Indicator whether DatetimeIndex is empty - * - :attr:`~DatetimeIndex.freq` - Return the frequency object - * - :attr:`~DatetimeIndex.has_duplicates` - Return if the index has duplicate values - * - :attr:`~DatetimeIndex.hour` - The hours of the datetime - * - :attr:`~DatetimeIndex.is_leap_year` - Boolean indicator if the date belongs to a leap year - * - :attr:`~DatetimeIndex.is_monotonic_decreasing` - Return if the index is monotonic decreasing - * - :attr:`~DatetimeIndex.is_monotonic_increasing` - Return if the index is monotonic increasing - * - :attr:`~DatetimeIndex.is_month_end` - Indicator for whether the date is the last day of the month - * - :attr:`~DatetimeIndex.is_month_start` - Indicator for whether the date is the first day of the month - * - :attr:`~DatetimeIndex.is_quarter_end` - Indicator for whether the date is the last day of a quarter - * - :attr:`~DatetimeIndex.is_quarter_start` - Indicator for whether the date is the first day of a quarter - * - :attr:`~DatetimeIndex.is_unique` - Return if the index has unique values - * - :attr:`~DatetimeIndex.is_year_end` - Indicator for whether the date is the last day of the year - * - :attr:`~DatetimeIndex.is_year_start` - Indicator for whether the date is the first day of the year - * - :attr:`~DatetimeIndex.microsecond` - The microseconds of the datetime - * - :attr:`~DatetimeIndex.minute` - The minutes of the datetime - * - :attr:`~DatetimeIndex.month` - The month of the datetime - * - :attr:`~DatetimeIndex.name` - Return the name of the DatetimeIndex - * - :attr:`~DatetimeIndex.nanosecond` - The nanoseconds of the datetime - * - :attr:`~DatetimeIndex.ndim` - Number of dimensions of the underlying data - * - :attr:`~DatetimeIndex.nlevels` - Number of levels in this index - * - :attr:`~DatetimeIndex.quarter` - The quarter of the date - * - :attr:`~DatetimeIndex.second` - The seconds of the datetime - * - :attr:`~DatetimeIndex.shape` - Return a tuple of the shape of the underlying data - * - :attr:`~DatetimeIndex.size` - Return the number of elements in the DatetimeIndex - * - :attr:`~DatetimeIndex.str` - Vectorized string functions for Index. - :ref:`View ` * - :attr:`~DatetimeIndex.tz` - Return timezone, if any - * - :attr:`~DatetimeIndex.weekday` - The day of the week with Monday=0, Sunday=6 - * - :attr:`~DatetimeIndex.year` - The year of the datetime - Construction ------------ .. list-table:: :widths: 25 60 15 :header-rows: 1 * - Method - Description - Example * - :meth:`~DatetimeIndex.__init__` ``(*args, **kwargs) | () | (data: object = None, freq: object = None, tz: object = None, normalize: object = None, closed: object = None, ambiguous: str = 'raise', dayfirst: bool = False, yearfirst: bool = False, dtype: object = None, copy: bool = False, name: object = None)`` - Create an empty DatetimeIndex - :ref:`View ` Indexing / Selection -------------------- .. list-table:: :widths: 25 60 15 :header-rows: 1 * - Method - Description - Example * - :meth:`~DatetimeIndex.__getitem__` ``(arg0: object)`` - - * - :meth:`~DatetimeIndex.take` ``(indices: collections.abc.Sequence[typing.SupportsInt], axis: typing.SupportsInt = 0, allow_fill: bool = True, fill_value: object = None)`` - Return a new DatetimeIndex of the values selected by the indices. - * - :meth:`~DatetimeIndex.where` ``(cond: collections.abc.Sequence[bool], other: object = None)`` - Replace values where the condition is False. - Data Manipulation ----------------- .. list-table:: :widths: 25 60 15 :header-rows: 1 * - Method - Description - Example * - :meth:`~DatetimeIndex.drop` ``(labels: collections.abc.Sequence[typing.SupportsInt], errors: str = 'raise')`` - Make new DatetimeIndex with passed list of labels deleted. - * - :meth:`~DatetimeIndex.droplevel` ``(level: typing.SupportsInt = 0)`` - Return index with requested level(s) removed. - * - :meth:`~DatetimeIndex.insert` ``(loc: typing.SupportsInt, item: typing.SupportsInt)`` - Insert new item at specified position - * - :meth:`~DatetimeIndex.reindex` ``(target: pandasCore.DatetimeIndex, method: object = None, level: object = None, limit: object = None, tolerance: object = None)`` - Conform DatetimeIndex to new index. - * - :meth:`~DatetimeIndex.rename` ``(name: object, *, inplace: bool = False)`` - Alter DatetimeIndex name. - * - :meth:`~DatetimeIndex.set_names` ``(names: object, *, level: object = None, inplace: bool = False)`` - Set DatetimeIndex name. - Missing Data ------------ .. list-table:: :widths: 25 60 15 :header-rows: 1 * - Method - Description - Example * - :meth:`~DatetimeIndex.dropna` ``(how: str = 'any')`` - Return DatetimeIndex without NA/NaT values. - * - :meth:`~DatetimeIndex.fillna` ``(value: object = None, downcast: object = None)`` - Fill NA/NaT values with the specified value. - * - :meth:`~DatetimeIndex.isna` ``()`` - Detect missing values (NaT) - * - :meth:`~DatetimeIndex.isnull` ``()`` - Alias for isna - * - :meth:`~DatetimeIndex.notna` ``()`` - Detect existing (non-missing) values - * - :meth:`~DatetimeIndex.notnull` ``()`` - Alias for notna - Statistics ---------- .. list-table:: :widths: 25 60 15 :header-rows: 1 * - Method - Description - Example * - :meth:`~DatetimeIndex.max` ``(axis: object = None, skipna: bool = True)`` - Return the maximum value of the Index. - * - :meth:`~DatetimeIndex.mean` ``(*, skipna: bool = True, axis: object = 0)`` - Return the mean value of the Index as nanoseconds. - * - :meth:`~DatetimeIndex.min` ``(axis: object = None, skipna: bool = True)`` - Return the minimum value of the Index. - * - :meth:`~DatetimeIndex.nunique` ``(dropna: bool = True)`` - Return number of unique elements - * - :meth:`~DatetimeIndex.std` ``(axis: object = None, dtype: object = None, out: object = None, ddof: typing.SupportsInt = 1, keepdims: bool = False, skipna: bool = True)`` - Return the standard deviation as nanoseconds. - * - :meth:`~DatetimeIndex.value_counts` ``(normalize: bool = False, sort: bool = True, ascending: bool = False, bins: object = None, dropna: bool = True)`` - Return a Series containing counts of unique values. - Aggregation ----------- .. list-table:: :widths: 25 60 15 :header-rows: 1 * - Method - Description - Example * - :meth:`~DatetimeIndex.groupby` ``(values: collections.abc.Sequence[typing.SupportsInt])`` - Group the index labels by a mapping - * - :meth:`~DatetimeIndex.map` ``(mapper: collections.abc.Callable, na_action: object = None)`` - Map values using an input mapping or function. - Comparison ---------- .. list-table:: :widths: 25 60 15 :header-rows: 1 * - Method - Description - Example * - :meth:`~DatetimeIndex.__eq__` ``(self, value, /)`` - Return self==value. - * - :meth:`~DatetimeIndex.__ge__` ``(self, value, /)`` - Return self>=value. - * - :meth:`~DatetimeIndex.__gt__` ``(self, value, /)`` - Return self>value. - * - :meth:`~DatetimeIndex.__le__` ``(self, value, /)`` - Return self<=value. - * - :meth:`~DatetimeIndex.__lt__` ``(self, value, /)`` - Return self