@@ -89,7 +89,7 @@ class DatetimeIndexOpsMixin(NDArrayBackedExtensionIndex, ABC):
8989 _data : DatetimeArray | TimedeltaArray | PeriodArray
9090
9191 def mean (self , * , skipna : bool = True , axis : int | None = 0 ):
92- """
92+ """
9393 Return the mean value of the Array.
9494
9595 Parameters
@@ -103,25 +103,9 @@ def mean(self, *, skipna: bool = True, axis: int | None = 0):
103103 -------
104104 scalar
105105 Timestamp or Timedelta.
106-
107- See Also
108- --------
109- DatetimeIndex.median : Return the median of the index.
110- DatetimeIndex.sum : Sum of the values in the index.
111- DatetimeIndex.inferred_freq : Attempt to infer frequency from values.
112-
113- Examples
114- --------
115- >>> import pandas as pd
116- >>> idx = pd.date_range("2020-01-01", periods=3)
117- >>> idx
118- DatetimeIndex(['2020-01-01', '2020-01-02', '2020-01-03'],
119- dtype='datetime64[ns]', freq='D')
120- >>> idx.mean()
121- Timestamp('2020-01-02 00:00:00')
122106 """
123107 return self ._data .mean (skipna = skipna , axis = axis )
124-
108+
125109 @property
126110 def freq (self ) -> BaseOffset | None :
127111 """
@@ -165,24 +149,6 @@ def asi8(self) -> npt.NDArray[np.int64]:
165149 def freqstr (self ) -> str :
166150 """
167151 Return the frequency string if it is set, otherwise None.
168-
169- Returns
170- -------
171- str or None
172- Frequency string such as 'D', 'H', etc., or None.
173-
174- See Also
175- --------
176- DatetimeIndex.freq : The offset object for the frequency.
177- PeriodIndex.freq : Return the frequency object for PeriodIndex.
178- DatetimeIndex.inferred_freq : Attempt to infer frequency from values.
179-
180- Examples
181- --------
182- >>> import pandas as pd
183- >>> idx = pd.date_range("2020-01-01", periods=3, freq="D")
184- >>> idx.freqstr
185- 'D'
186152 """
187153 from pandas import PeriodIndex
188154
@@ -617,28 +583,14 @@ def shift(self, periods: int = 1, freq=None) -> Self:
617583 )
618584 return type (self )._simple_new (result , name = self .name )
619585
620- @cache_readonly
586+ @cache_readonly
621587 def inferred_freq (self ) -> str | None :
622588 """
623589 Tries to return a string representing a frequency guess generated by infer_freq.
624590
625591 Returns
626592 -------
627593 str or None
628- Inferred frequency string (e.g. 'D', 'H') or None if it cannot be inferred.
629-
630- See Also
631- --------
632- DatetimeIndex.freqstr : Readable frequency string.
633- DatetimeIndex.freq : The offset object for the frequency.
634- pandas.infer_freq : Lower-level frequency inference utility.
635-
636- Examples
637- --------
638- >>> import pandas as pd
639- >>> idx = pd.to_datetime(['2020-01-01', '2020-01-02', '2020-01-03'])
640- >>> idx.inferred_freq
641- 'D'
642594 """
643595 return self ._data .inferred_freq
644596
0 commit comments