|
36 | 36 | NullFrequencyError, |
37 | 37 | ) |
38 | 38 | from pandas.util._decorators import ( |
| 39 | + Appender, |
39 | 40 | cache_readonly, |
| 41 | + doc, |
40 | 42 | ) |
41 | 43 |
|
42 | 44 | from pandas.core.dtypes.common import ( |
|
55 | 57 | PeriodArray, |
56 | 58 | TimedeltaArray, |
57 | 59 | ) |
| 60 | +from pandas.core.arrays.datetimelike import DatetimeLikeArrayMixin |
58 | 61 | import pandas.core.common as com |
59 | 62 | import pandas.core.indexes.base as ibase |
60 | 63 | from pandas.core.indexes.base import ( |
61 | 64 | Index, |
| 65 | + _index_shared_docs, |
62 | 66 | ) |
63 | 67 | from pandas.core.indexes.extension import NDArrayBackedExtensionIndex |
64 | 68 | from pandas.core.indexes.range import RangeIndex |
@@ -103,6 +107,21 @@ def mean(self, *, skipna: bool = True, axis: int | None = 0): |
103 | 107 | ------- |
104 | 108 | scalar |
105 | 109 | Timestamp or Timedelta. |
| 110 | +
|
| 111 | + See Also |
| 112 | + -------- |
| 113 | + numpy.ndarray.mean : Returns the average of the array elements. |
| 114 | + Series.mean : Return the mean value in a Series. |
| 115 | +
|
| 116 | + Examples |
| 117 | + -------- |
| 118 | + >>> idx = pd.date_range('2023-01-01', periods=3) |
| 119 | + >>> idx.mean() |
| 120 | + Timestamp('2023-01-02 00:00:00') |
| 121 | +
|
| 122 | + >>> idx = pd.to_timedelta([1, 2, 3], unit='D') |
| 123 | + >>> idx.mean() |
| 124 | + Timedelta('2 days 00:00:00') |
106 | 125 | """ |
107 | 126 | return self._data.mean(skipna=skipna, axis=axis) |
108 | 127 |
|
@@ -149,6 +168,18 @@ def asi8(self) -> npt.NDArray[np.int64]: |
149 | 168 | def freqstr(self) -> str: |
150 | 169 | """ |
151 | 170 | Return the frequency string if it is set, otherwise None. |
| 171 | +
|
| 172 | + See Also |
| 173 | + -------- |
| 174 | + DatetimeIndex.freq : Return the frequency object if it is set, otherwise None. |
| 175 | + DatetimeIndex.inferred_freq : Tries to return a string representing a frequency |
| 176 | + guess generated by infer_freq. |
| 177 | +
|
| 178 | + Examples |
| 179 | + -------- |
| 180 | + >>> idx = pd.date_range('2023-01-01', periods=3, freq='D') |
| 181 | + >>> idx.freqstr |
| 182 | + 'D' |
152 | 183 | """ |
153 | 184 | from pandas import PeriodIndex |
154 | 185 |
|
@@ -591,6 +622,17 @@ def inferred_freq(self) -> str | None: |
591 | 622 | Returns |
592 | 623 | ------- |
593 | 624 | str or None |
| 625 | +
|
| 626 | + See Also |
| 627 | + -------- |
| 628 | + DatetimeIndex.freq : Return the frequency object if it is set, otherwise None. |
| 629 | + DatetimeIndex.freqstr : Return the frequency string if it is set, otherwise None. |
| 630 | +
|
| 631 | + Examples |
| 632 | + -------- |
| 633 | + >>> idx = pd.DatetimeIndex(['2018-01-01', '2018-01-03', '2018-01-05']) |
| 634 | + >>> idx.inferred_freq |
| 635 | + '2D' |
594 | 636 | """ |
595 | 637 | return self._data.inferred_freq |
596 | 638 |
|
|
0 commit comments