diff --git a/ci/code_checks.sh b/ci/code_checks.sh index 3aa78804b6dde..cc7c64f001809 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -138,25 +138,7 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then pandas.util.hash_pandas_object \ pandas_object \ pandas.api.interchange.from_dataframe \ - pandas.CategoricalIndex.codes \ - pandas.CategoricalIndex.categories \ - pandas.CategoricalIndex.ordered \ - pandas.CategoricalIndex.reorder_categories \ - pandas.CategoricalIndex.set_categories \ - pandas.CategoricalIndex.as_ordered \ - pandas.CategoricalIndex.as_unordered \ - pandas.CategoricalIndex.equals \ - pandas.IntervalIndex.values \ - pandas.IntervalIndex.to_tuples \ - pandas.MultiIndex.dtypes \ - pandas.MultiIndex.drop \ pandas.DatetimeIndex.snap \ - pandas.DatetimeIndex.as_unit \ - pandas.DatetimeIndex.to_pydatetime \ - pandas.DatetimeIndex.to_series \ - pandas.DatetimeIndex.mean \ - pandas.DatetimeIndex.std \ - pandas.TimedeltaIndex \ pandas.core.window.rolling.Rolling.max \ pandas.core.window.rolling.Rolling.cov \ pandas.core.window.rolling.Rolling.skew \ diff --git a/pandas/core/arrays/categorical.py b/pandas/core/arrays/categorical.py index a226c71934a64..fdf4434d89f4c 100644 --- a/pandas/core/arrays/categorical.py +++ b/pandas/core/arrays/categorical.py @@ -272,7 +272,7 @@ class Categorical(NDArrayBackedExtensionArray, PandasObject, ObjectStringArrayMi Attributes ---------- categories : Index - The categories of this categorical + The categories of this categorical. codes : ndarray The codes (integer positions, which point to the categories) of this categorical, read only. @@ -760,23 +760,32 @@ def categories(self) -> Index: Examples -------- + For :class:`pandas.Series`: - For Series: - - >>> ser = pd.Series(["a", "b", "c", "a"], dtype="category") + >>> ser = pd.Series(['a', 'b', 'c', 'a'], dtype='category') >>> ser.cat.categories Index(['a', 'b', 'c'], dtype='object') - >>> raw_cat = pd.Categorical(["a", "b", "c", "a"], categories=["b", "c", "d"],) + >>> raw_cat = pd.Categorical(['a', 'b', 'c', 'a'], categories=['b', 'c', 'd']) >>> ser = pd.Series(raw_cat) >>> ser.cat.categories Index(['b', 'c', 'd'], dtype='object') - For Categorical: + For :class:`pandas.Categorical`: >>> cat = pd.Categorical(['a', 'b'], ordered=True) >>> cat.categories Index(['a', 'b'], dtype='object') + + For :class:`pandas.CategoricalIndex`: + + >>> ci = pd.CategoricalIndex(['a', 'c', 'b', 'a', 'c', 'b']) + >>> ci.categories + Index(['a', 'b', 'c'], dtype='object') + + >>> ci = pd.CategoricalIndex(['a', 'c'], categories=['c', 'b', 'a']) + >>> ci.categories + Index(['c', 'b', 'a'], dtype='object') """ return self.dtype.categories @@ -787,19 +796,18 @@ def ordered(self) -> Ordered: Examples -------- + For :class:`pandas.Series`: - For Series: - - >>> ser = pd.Series(["a", "b", "c", "a"], dtype="category") + >>> ser = pd.Series(['a', 'b', 'c', 'a'], dtype='category') >>> ser.cat.ordered False - >>> raw_cat = pd.Categorical(["a", "b", "c", "a"], ordered=True) + >>> raw_cat = pd.Categorical(['a', 'b', 'c', 'a'], ordered=True) >>> ser = pd.Series(raw_cat) >>> ser.cat.ordered True - For Categorical: + For :class:`pandas.Categorical`: >>> cat = pd.Categorical(['a', 'b'], ordered=True) >>> cat.ordered @@ -808,13 +816,23 @@ def ordered(self) -> Ordered: >>> cat = pd.Categorical(['a', 'b'], ordered=False) >>> cat.ordered False + + For :class:`pandas.CategoricalIndex`: + + >>> ci = pd.CategoricalIndex(['a', 'b'], ordered=True) + >>> ci.ordered + True + + >>> ci = pd.CategoricalIndex(['a', 'b'], ordered=False) + >>> ci.ordered + False """ return self.dtype.ordered @property def codes(self) -> np.ndarray: """ - The category codes of this categorical. + The category codes of this categorical index. Codes are an array of integers which are the positions of the actual values in the categories array. @@ -825,13 +843,25 @@ def codes(self) -> np.ndarray: Returns ------- ndarray[int] - A non-writable view of the `codes` array. + A non-writable view of the ``codes`` array. Examples -------- + For :class:`pandas.Categorical`: + >>> cat = pd.Categorical(['a', 'b'], ordered=True) >>> cat.codes array([0, 1], dtype=int8) + + For :class:`pandas.CategoricalIndex`: + + >>> ci = pd.CategoricalIndex(['a', 'b', 'c', 'a', 'b', 'c']) + >>> ci.codes + array([0, 1, 2, 0, 1, 2], dtype=int8) + + >>> ci = pd.CategoricalIndex(['a', 'c'], categories=['c', 'b', 'a']) + >>> ci.codes + array([2, 0], dtype=int8) """ v = self._codes.view() v.flags.writeable = False @@ -915,12 +945,23 @@ def as_ordered(self) -> Self: Examples -------- - >>> ser = pd.Series(["a", "b", "c", "a"], dtype="category") + For :class:`pandas.Series`: + + >>> ser = pd.Series(['a', 'b', 'c', 'a'], dtype='category') >>> ser.cat.ordered False >>> ser = ser.cat.as_ordered() >>> ser.cat.ordered True + + For :class:`pandas.CategoricalIndex`: + + >>> ci = pd.CategoricalIndex(['a', 'b', 'c', 'a']) + >>> ci.ordered + False + >>> ci = ci.as_ordered() + >>> ci.ordered + True """ return self.set_ordered(True) @@ -935,24 +976,36 @@ def as_unordered(self) -> Self: Examples -------- - >>> raw_cate = pd.Categorical(["a", "b", "c"], - ... categories=["a", "b", "c"], ordered=True) - >>> ser = pd.Series(raw_cate) + For :class:`pandas.Series`: + + >>> raw_cat = pd.Categorical(['a', 'b', 'c', 'a'], ordered=True) + >>> ser = pd.Series(raw_cat) + >>> ser.cat.ordered + True >>> ser = ser.cat.as_unordered() >>> ser.cat.ordered False + + For :class:`pandas.CategoricalIndex`: + + >>> ci = pd.CategoricalIndex(['a', 'b', 'c', 'a'], ordered=True) + >>> ci.ordered + True + >>> ci = ci.as_unordered() + >>> ci.ordered + False """ return self.set_ordered(False) def set_categories(self, new_categories, ordered=None, rename: bool = False): """ - Set the categories to the specified new_categories. + Set the categories to the specified new categories. - `new_categories` can include new categories (which will result in + ``new_categories`` can include new categories (which will result in unused categories) or remove old categories (which results in values - set to NaN). If `rename==True`, the categories will simple be renamed + set to ``NaN``). If ``rename=True``, the categories will simply be renamed (less or more items than in old categories will result in values set to - NaN or in unused categories respectively). + ``NaN`` or in unused categories respectively). This method can be used to perform more than one action of adding, removing, and reordering simultaneously and is therefore faster than @@ -994,9 +1047,11 @@ def set_categories(self, new_categories, ordered=None, rename: bool = False): Examples -------- - >>> raw_cate = pd.Categorical(["a", "b", "c", "A"], - ... categories=["a", "b", "c"], ordered=True) - >>> ser = pd.Series(raw_cate) + For :class:`pandas.Series`: + + >>> raw_cat = pd.Categorical(['a', 'b', 'c', 'A'], + ... categories=['a', 'b', 'c'], ordered=True) + >>> ser = pd.Series(raw_cat) >>> ser 0 a 1 b @@ -1004,13 +1059,29 @@ def set_categories(self, new_categories, ordered=None, rename: bool = False): 3 NaN dtype: category Categories (3, object): ['a' < 'b' < 'c'] - >>> ser.cat.set_categories(["A", "B", "C"], rename=True) + + >>> ser.cat.set_categories(['A', 'B', 'C'], rename=True) 0 A 1 B 2 C 3 NaN dtype: category Categories (3, object): ['A' < 'B' < 'C'] + + For :class:`pandas.CategoricalIndex`: + + >>> ci = pd.CategoricalIndex(['a', 'b', 'c', 'A'], + ... categories=['a', 'b', 'c'], ordered=True) + >>> ci + CategoricalIndex(['a', 'b', 'c', nan], categories=['a', 'b', 'c'], + ordered=True, dtype='category') + + >>> ci.set_categories(['A', 'b', 'c']) + CategoricalIndex([nan, 'b', 'c', nan], categories=['A', 'b', 'c'], + ordered=True, dtype='category') + >>> ci.set_categories(['A', 'b', 'c'], rename=True) + CategoricalIndex(['A', 'b', 'c', nan], categories=['A', 'b', 'c'], + ordered=True, dtype='category') """ if ordered is None: @@ -1108,7 +1179,7 @@ def reorder_categories(self, new_categories, ordered=None) -> Self: """ Reorder categories as specified in new_categories. - `new_categories` need to include all old categories and no new category + ``new_categories`` need to include all old categories and no new category items. Parameters @@ -1140,7 +1211,9 @@ def reorder_categories(self, new_categories, ordered=None) -> Self: Examples -------- - >>> ser = pd.Series(["a", "b", "c", "a"], dtype="category") + For :class:`pandas.Series`: + + >>> ser = pd.Series(['a', 'b', 'c', 'a'], dtype='category') >>> ser = ser.cat.reorder_categories(['c', 'b', 'a'], ordered=True) >>> ser 0 a @@ -1149,14 +1222,24 @@ def reorder_categories(self, new_categories, ordered=None) -> Self: 3 a dtype: category Categories (3, object): ['c' < 'b' < 'a'] - >>> ser = ser.sort_values() - >>> ser + + >>> ser.sort_values() 2 c 1 b 0 a 3 a dtype: category Categories (3, object): ['c' < 'b' < 'a'] + + For :class:`pandas.CategoricalIndex`: + + >>> ci = pd.CategoricalIndex(['a', 'b', 'c', 'a']) + >>> ci + CategoricalIndex(['a', 'b', 'c', 'a'], categories=['a', 'b', 'c'], + ordered=False, dtype='category') + >>> ci.reorder_categories(['c', 'b', 'a'], ordered=True) + CategoricalIndex(['a', 'b', 'c', 'a'], categories=['c', 'b', 'a'], + ordered=True, dtype='category') """ if ( len(self.categories) != len(new_categories) diff --git a/pandas/core/arrays/datetimelike.py b/pandas/core/arrays/datetimelike.py index bef8b55b876a2..86849aa41e3e1 100644 --- a/pandas/core/arrays/datetimelike.py +++ b/pandas/core/arrays/datetimelike.py @@ -1552,6 +1552,17 @@ def mean(self, *, skipna: bool = True, axis: AxisInt | None = 0): Examples -------- + For :class:`pandas.DatetimeIndex`: + + >>> idx = pd.date_range('2001-01-01 00:00', periods=3) + >>> idx + DatetimeIndex(['2001-01-01', '2001-01-02', '2001-01-03'], + dtype='datetime64[ns]', freq='D') + >>> idx.mean() + Timestamp('2001-01-02 00:00:00') + + For :class:`pandas.TimedeltaIndex`: + >>> tdelta_idx = pd.to_timedelta([1, 2, 3], unit='D') >>> tdelta_idx TimedeltaIndex(['1 days', '2 days', '3 days'], diff --git a/pandas/core/arrays/datetimes.py b/pandas/core/arrays/datetimes.py index d6afba8c34904..3427ba025118a 100644 --- a/pandas/core/arrays/datetimes.py +++ b/pandas/core/arrays/datetimes.py @@ -1090,11 +1090,19 @@ def tz_localize( def to_pydatetime(self) -> npt.NDArray[np.object_]: """ - Return an ndarray of datetime.datetime objects. + Return an ndarray of ``datetime.datetime`` objects. Returns ------- numpy.ndarray + + Examples + -------- + >>> idx = pd.date_range('2018-02-27', periods=3) + >>> idx.to_pydatetime() + array([datetime.datetime(2018, 2, 27, 0, 0), + datetime.datetime(2018, 2, 28, 0, 0), + datetime.datetime(2018, 3, 1, 0, 0)], dtype=object) """ return ints_to_pydatetime(self.asi8, tz=self.tz, reso=self._creso) @@ -2097,23 +2105,40 @@ def std( """ Return sample standard deviation over requested axis. - Normalized by N-1 by default. This can be changed using the ddof argument + Normalized by `N-1` by default. This can be changed using ``ddof``. Parameters ---------- - axis : int optional, default None - Axis for the function to be applied on. - For `Series` this parameter is unused and defaults to `None`. + axis : int, optional + Axis for the function to be applied on. For :class:`pandas.Series` + this parameter is unused and defaults to ``None``. ddof : int, default 1 - Degrees of Freedom. The divisor used in calculations is N - ddof, - where N represents the number of elements. + Degrees of Freedom. The divisor used in calculations is `N - ddof`, + where `N` represents the number of elements. skipna : bool, default True - Exclude NA/null values. If an entire row/column is NA, the result will be - NA. + Exclude NA/null values. If an entire row/column is ``NA``, the result + will be ``NA``. Returns ------- Timedelta + + See Also + -------- + numpy.ndarray.std : Returns the standard deviation of the array elements + along given axis. + Series.std : Return sample standard deviation over requested axis. + + Examples + -------- + For :class:`pandas.DatetimeIndex`: + + >>> idx = pd.date_range('2001-01-01 00:00', periods=3) + >>> idx + DatetimeIndex(['2001-01-01', '2001-01-02', '2001-01-03'], + dtype='datetime64[ns]', freq='D') + >>> idx.std() + Timedelta('1 days 00:00:00') """ # Because std is translation-invariant, we can get self.std # by calculating (self - Timestamp(0)).std, and we can do it diff --git a/pandas/core/arrays/interval.py b/pandas/core/arrays/interval.py index 7f874a07341eb..446c0957db343 100644 --- a/pandas/core/arrays/interval.py +++ b/pandas/core/arrays/interval.py @@ -1644,8 +1644,8 @@ def __arrow_array__(self, type=None): Parameters ---------- na_tuple : bool, default True - Returns NA as a tuple if True, ``(nan, nan)``, or just as the NA - value itself if False, ``nan``. + If ``True``, return ``NA`` as a tuple ``(nan, nan)``. If ``False``, + just return ``NA`` as ``nan``. Returns ------- @@ -1657,12 +1657,16 @@ def __arrow_array__(self, type=None): @Appender( _interval_shared_docs["to_tuples"] % { - "return_type": "ndarray", + "return_type": ( + "ndarray (if self is IntervalArray) or Index (if self is IntervalIndex)" + ), "examples": textwrap.dedent( """\ Examples -------- + For :class:`pandas.IntervalArray`: + >>> idx = pd.arrays.IntervalArray.from_tuples([(0, 1), (1, 2)]) >>> idx @@ -1670,6 +1674,14 @@ def __arrow_array__(self, type=None): Length: 2, dtype: interval[int64, right] >>> idx.to_tuples() array([(0, 1), (1, 2)], dtype=object) + + For :class:`pandas.IntervalIndex`: + + >>> idx = pd.interval_range(start=0, end=2) + >>> idx + IntervalIndex([(0, 1], (1, 2]], dtype='interval[int64, right]') + >>> idx.to_tuples() + Index([(0, 1), (1, 2)], dtype='object') """ ), } diff --git a/pandas/core/indexes/base.py b/pandas/core/indexes/base.py index f72c7b9512126..f03af387151b2 100644 --- a/pandas/core/indexes/base.py +++ b/pandas/core/indexes/base.py @@ -1549,7 +1549,7 @@ def to_series(self, index=None, name: Hashable = None) -> Series: -------- >>> idx = pd.Index(['Ant', 'Bear', 'Cow'], name='animal') - By default, the original Index and original name is reused. + By default, the original index and original name is reused. >>> idx.to_series() animal @@ -1558,7 +1558,7 @@ def to_series(self, index=None, name: Hashable = None) -> Series: Cow Cow Name: animal, dtype: object - To enforce a new Index, specify new labels to ``index``: + To enforce a new index, specify new labels to ``index``: >>> idx.to_series(index=[0, 1, 2]) 0 Ant @@ -1566,7 +1566,7 @@ def to_series(self, index=None, name: Hashable = None) -> Series: 2 Cow Name: animal, dtype: object - To override the name of the resulting column, specify `name`: + To override the name of the resulting column, specify ``name``: >>> idx.to_series(name='zoo') animal @@ -5053,11 +5053,21 @@ def values(self) -> ArrayLike: Examples -------- + For :class:`pandas.Index`: + >>> idx = pd.Index([1, 2, 3]) >>> idx Index([1, 2, 3], dtype='int64') >>> idx.values array([1, 2, 3]) + + For :class:`pandas.IntervalIndex`: + + >>> idx = pd.interval_range(start=0, end=5) + >>> idx.values + + [(0, 1], (1, 2], (2, 3], (3, 4], (4, 5]] + Length: 5, dtype: interval[int64, right] """ if using_copy_on_write(): data = self._data diff --git a/pandas/core/indexes/category.py b/pandas/core/indexes/category.py index d2ef607635abb..9bd0bc98dc733 100644 --- a/pandas/core/indexes/category.py +++ b/pandas/core/indexes/category.py @@ -280,8 +280,43 @@ def equals(self, other: object) -> bool: Returns ------- bool - If two CategoricalIndex objects have equal elements True, - otherwise False. + ``True`` if two :class:`pandas.CategoricalIndex` objects have equal + elements, ``False`` otherwise. + + Examples + -------- + >>> ci = pd.CategoricalIndex(['a', 'b', 'c', 'a', 'b', 'c']) + >>> ci2 = pd.CategoricalIndex(pd.Categorical(['a', 'b', 'c', 'a', 'b', 'c'])) + >>> ci.equals(ci2) + True + + The order of elements matters. + + >>> ci3 = pd.CategoricalIndex(['c', 'b', 'a', 'a', 'b', 'c']) + >>> ci.equals(ci3) + False + + The orderedness also matters. + + >>> ci4 = ci.as_ordered() + >>> ci.equals(ci4) + False + + The categories matter, but the order of the categories matters only when + ``ordered=True``. + + >>> ci5 = ci.set_categories(['a', 'b', 'c', 'd']) + >>> ci.equals(ci5) + False + + >>> ci6 = ci.set_categories(['b', 'c', 'a']) + >>> ci.equals(ci6) + True + >>> ci_ordered = pd.CategoricalIndex(['a', 'b', 'c', 'a', 'b', 'c'], + ... ordered=True) + >>> ci2_ordered = ci_ordered.set_categories(['b', 'c', 'a']) + >>> ci_ordered.equals(ci2_ordered) + False """ if self.is_(other): return True diff --git a/pandas/core/indexes/datetimelike.py b/pandas/core/indexes/datetimelike.py index 2125c1aef6162..c4be04c469fae 100644 --- a/pandas/core/indexes/datetimelike.py +++ b/pandas/core/indexes/datetimelike.py @@ -436,6 +436,17 @@ def as_unit(self, unit: str) -> Self: Examples -------- + For :class:`pandas.DatetimeIndex`: + + >>> idx = pd.DatetimeIndex(['2020-01-02 01:02:03.004005006']) + >>> idx + DatetimeIndex(['2020-01-02 01:02:03.004005006'], + dtype='datetime64[ns]', freq=None) + >>> idx.as_unit('s') + DatetimeIndex(['2020-01-02 01:02:03'], dtype='datetime64[s]', freq=None) + + For :class:`pandas.TimedeltaIndex`: + >>> tdelta_idx = pd.to_timedelta(['1 day 3 min 2 us 42 ns']) >>> tdelta_idx TimedeltaIndex(['1 days 00:03:00.000002042'], diff --git a/pandas/core/indexes/multi.py b/pandas/core/indexes/multi.py index 5181623c0c327..824ffa5cf4c67 100644 --- a/pandas/core/indexes/multi.py +++ b/pandas/core/indexes/multi.py @@ -797,6 +797,23 @@ def array(self): def dtypes(self) -> Series: """ Return the dtypes as a Series for the underlying MultiIndex. + + Examples + -------- + >>> idx = pd.MultiIndex.from_product([(0, 1, 2), ('green', 'purple')], + ... names=['number', 'color']) + >>> idx + MultiIndex([(0, 'green'), + (0, 'purple'), + (1, 'green'), + (1, 'purple'), + (2, 'green'), + (2, 'purple')], + names=['number', 'color']) + >>> idx.dtypes + number int64 + color object + dtype: object """ from pandas import Series @@ -2222,18 +2239,50 @@ def drop( # type: ignore[override] errors: IgnoreRaise = "raise", ) -> MultiIndex: """ - Make new MultiIndex with passed list of codes deleted. + Make a new :class:`pandas.MultiIndex` with the passed list of codes deleted. Parameters ---------- codes : array-like - Must be a list of tuples when level is not specified. + Must be a list of tuples when ``level`` is not specified. level : int or level name, default None errors : str, default 'raise' Returns ------- MultiIndex + + Examples + -------- + >>> idx = pd.MultiIndex.from_product([(0, 1, 2), ('green', 'purple')], + ... names=["number", "color"]) + >>> idx + MultiIndex([(0, 'green'), + (0, 'purple'), + (1, 'green'), + (1, 'purple'), + (2, 'green'), + (2, 'purple')], + names=['number', 'color']) + >>> idx.drop([(1, 'green'), (2, 'purple')]) + MultiIndex([(0, 'green'), + (0, 'purple'), + (1, 'purple'), + (2, 'green')], + names=['number', 'color']) + + We can also drop from a specific level. + + >>> idx.drop('green', level='color') + MultiIndex([(0, 'purple'), + (1, 'purple'), + (2, 'purple')], + names=['number', 'color']) + + >>> idx.drop([1, 2], level=0) + MultiIndex([(0, 'green'), + (0, 'purple')], + names=['number', 'color']) """ if level is not None: return self._drop_from_level(codes, level, errors) diff --git a/pandas/core/indexes/timedeltas.py b/pandas/core/indexes/timedeltas.py index d7d2875df730d..cd6a4883946d2 100644 --- a/pandas/core/indexes/timedeltas.py +++ b/pandas/core/indexes/timedeltas.py @@ -60,19 +60,19 @@ class TimedeltaIndex(DatetimeTimedeltaMixin): Parameters ---------- - data : array-like (1-dimensional), optional + data : array-like (1-dimensional), optional Optional timedelta-like data to construct index with. - unit : unit of the arg (D,h,m,s,ms,us,ns) denote the unit, optional - Which is an integer/float number. + unit : {'D', 'h', 'm', 's', 'ms', 'us', 'ns'}, optional + The unit of ``data``. 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. + ``'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 ndarray. + 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. @@ -107,6 +107,22 @@ class TimedeltaIndex(DatetimeTimedeltaMixin): ----- To learn more about the frequency strings, please see `this link `__. + + 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) + + >>> pd.TimedeltaIndex([1, 2, 4, 8], unit='D') + TimedeltaIndex(['1 days', '2 days', '4 days', '8 days'], + dtype='timedelta64[ns]', freq=None) + + We can also let pandas infer the frequency when possible. + + >>> pd.TimedeltaIndex(range(5), unit='D', freq='infer') + TimedeltaIndex(['0 days', '1 days', '2 days', '3 days', '4 days'], + dtype='timedelta64[ns]', freq='D') """ _typ = "timedeltaindex"