From cd569295ea474b07497aaa98f7c27e3fecd12d3a Mon Sep 17 00:00:00 2001 From: Jixun Sun <160219251+AnonToky@users.noreply.github.com> Date: Tue, 11 Nov 2025 13:13:37 +0800 Subject: [PATCH 01/12] Fix zip function call to include strict parameter --- pandas/core/reshape/encoding.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/core/reshape/encoding.py b/pandas/core/reshape/encoding.py index 24efa34870545..c719f15c0b0ca 100644 --- a/pandas/core/reshape/encoding.py +++ b/pandas/core/reshape/encoding.py @@ -538,7 +538,7 @@ def from_dummies( raise ValueError(len_msg) elif isinstance(default_category, Hashable): default_category = dict( - zip(variables_slice, [default_category] * len(variables_slice)) + zip(variables_slice, [default_category] * len(variables_slice), strict=True) ) else: raise TypeError( From bc08bff12cfb2c4c1e4139d8d8c429925293281e Mon Sep 17 00:00:00 2001 From: Jixun Sun <160219251+AnonToky@users.noreply.github.com> Date: Tue, 11 Nov 2025 13:23:53 +0800 Subject: [PATCH 02/12] handled the too-long modified --- pandas/core/reshape/encoding.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pandas/core/reshape/encoding.py b/pandas/core/reshape/encoding.py index c719f15c0b0ca..1c414d0b6d2a0 100644 --- a/pandas/core/reshape/encoding.py +++ b/pandas/core/reshape/encoding.py @@ -538,7 +538,8 @@ def from_dummies( raise ValueError(len_msg) elif isinstance(default_category, Hashable): default_category = dict( - zip(variables_slice, [default_category] * len(variables_slice), strict=True) + zip(variables_slice, + [default_category] * len(variables_slice), strict=True) ) else: raise TypeError( From 74a09aedc740653a6178f2079471ae9d1f1aa3ee Mon Sep 17 00:00:00 2001 From: Jixun Sun <160219251+AnonToky@users.noreply.github.com> Date: Tue, 11 Nov 2025 13:35:42 +0800 Subject: [PATCH 03/12] edited --- pandas/core/reshape/encoding.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandas/core/reshape/encoding.py b/pandas/core/reshape/encoding.py index 1c414d0b6d2a0..b45660abda314 100644 --- a/pandas/core/reshape/encoding.py +++ b/pandas/core/reshape/encoding.py @@ -538,8 +538,8 @@ def from_dummies( raise ValueError(len_msg) elif isinstance(default_category, Hashable): default_category = dict( - zip(variables_slice, - [default_category] * len(variables_slice), strict=True) + zip(variables_slice, [default_category] * len(variables_slice), + strict=True) ) else: raise TypeError( From 2200f710430482a07ad74c914d77c58c346fc844 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 11 Nov 2025 08:52:59 +0000 Subject: [PATCH 04/12] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- pandas/core/reshape/encoding.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pandas/core/reshape/encoding.py b/pandas/core/reshape/encoding.py index b45660abda314..35fed5a24fb30 100644 --- a/pandas/core/reshape/encoding.py +++ b/pandas/core/reshape/encoding.py @@ -538,8 +538,11 @@ def from_dummies( raise ValueError(len_msg) elif isinstance(default_category, Hashable): default_category = dict( - zip(variables_slice, [default_category] * len(variables_slice), - strict=True) + zip( + variables_slice, + [default_category] * len(variables_slice), + strict=True, + ) ) else: raise TypeError( From 5c9d1be6cb75a50e163cc068de56b409f331f3ed Mon Sep 17 00:00:00 2001 From: Jixun Sun <160219251+AnonToky@users.noreply.github.com> Date: Wed, 19 Nov 2025 21:14:45 +0800 Subject: [PATCH 05/12] Refactor datetimelike.py by cleaning up decorators Removed unused decorators and added docstrings to several methods. --- pandas/core/indexes/datetimelike.py | 148 +++++++++++++++++++++++++--- 1 file changed, 133 insertions(+), 15 deletions(-) diff --git a/pandas/core/indexes/datetimelike.py b/pandas/core/indexes/datetimelike.py index 58529c5597b6e..f1d324fec697c 100644 --- a/pandas/core/indexes/datetimelike.py +++ b/pandas/core/indexes/datetimelike.py @@ -36,9 +36,7 @@ NullFrequencyError, ) from pandas.util._decorators import ( - Appender, cache_readonly, - doc, ) from pandas.core.dtypes.common import ( @@ -57,12 +55,10 @@ PeriodArray, TimedeltaArray, ) -from pandas.core.arrays.datetimelike import DatetimeLikeArrayMixin import pandas.core.common as com import pandas.core.indexes.base as ibase from pandas.core.indexes.base import ( Index, - _index_shared_docs, ) from pandas.core.indexes.extension import NDArrayBackedExtensionIndex from pandas.core.indexes.range import RangeIndex @@ -92,8 +88,22 @@ class DatetimeIndexOpsMixin(NDArrayBackedExtensionIndex, ABC): _can_hold_strings = False _data: DatetimeArray | TimedeltaArray | PeriodArray - @doc(DatetimeLikeArrayMixin.mean) def mean(self, *, skipna: bool = True, axis: int | None = 0): + """ + Return the mean value of the Array. + + Parameters + ---------- + skipna : bool, default True + Whether to ignore any NaT elements. + axis : int, optional, default 0 + Axis along which to compute the mean. + + Returns + ------- + scalar + Timestamp or Timedelta. + """ return self._data.mean(skipna=skipna, axis=axis) @property @@ -136,8 +146,10 @@ def asi8(self) -> npt.NDArray[np.int64]: return self._data.asi8 @property - @doc(DatetimeLikeArrayMixin.freqstr) def freqstr(self) -> str: + """ + Return the frequency string if it is set, otherwise None. + """ from pandas import PeriodIndex if self._data.freqstr is not None and isinstance( @@ -153,8 +165,15 @@ def freqstr(self) -> str: def _resolution_obj(self) -> Resolution: ... @cache_readonly - @doc(DatetimeLikeArrayMixin.resolution) def resolution(self) -> str: + """ + Return the resolution of the array. + + Returns + ------- + str + The resolution of the array. + """ return self._data.resolution # ------------------------------------------------------------------------ @@ -199,8 +218,10 @@ def equals(self, other: Any) -> bool: return np.array_equal(self.asi8, other.asi8) - @Appender(Index.__contains__.__doc__) def __contains__(self, key: Any) -> bool: + """ + Return True if the key is in the Index. + """ hash(key) try: self.get_loc(key) @@ -243,8 +264,10 @@ def _format_attrs(self): attrs.append(("freq", freq)) return attrs - @Appender(Index._summary.__doc__) def _summary(self, name=None) -> str: + """ + Return a summary of the Index. + """ result = super()._summary(name=name) if self.freq: result += f"\nFreq: {self.freqstr}" @@ -405,8 +428,20 @@ def shift(self, periods: int = 1, freq=None) -> Self: # -------------------------------------------------------------------- - @doc(Index._maybe_cast_listlike_indexer) def _maybe_cast_listlike_indexer(self, keyarr): + """ + Ensure that the list-like indexer is of the correct type. + + Parameters + ---------- + keyarr : list-like + The list-like indexer to check. + + Returns + ------- + list-like + The list-like indexer of the correct type. + """ try: res = self._data._validate_listlike(keyarr, allow_object=True) except (ValueError, TypeError): @@ -497,8 +532,33 @@ def values(self) -> np.ndarray: data.flags.writeable = False return data - @doc(DatetimeIndexOpsMixin.shift) def shift(self, periods: int = 1, freq=None) -> Self: + """ + Shift index by desired number of time frequency increments. + + This method is for shifting the values of datetime-like indexes + by a specified time increment a given number of times. + + Parameters + ---------- + periods : int, default 1 + Number of periods (or increments) to shift by, + can be positive or negative. + freq : pandas.DateOffset, pandas.Timedelta or string, optional + Frequency increment to shift by. + If None, the index is shifted by its own `freq` attribute. + Offset aliases are valid strings, e.g., 'D', 'W', 'M' etc. + + Returns + ------- + pandas.DatetimeIndex + Shifted index. + + See Also + -------- + Index.shift : Shift values of Index. + PeriodIndex.shift : Shift values of PeriodIndex. + """ if freq is not None and freq != self.freq: if isinstance(freq, str): freq = to_offset(freq) @@ -524,8 +584,14 @@ def shift(self, periods: int = 1, freq=None) -> Self: return type(self)._simple_new(result, name=self.name) @cache_readonly - @doc(DatetimeLikeArrayMixin.inferred_freq) def inferred_freq(self) -> str | None: + """ + Tries to return a string representing a frequency guess generated by infer_freq. + + Returns + ------- + str or None + """ return self._data.inferred_freq # -------------------------------------------------------------------- @@ -816,14 +882,41 @@ def _get_insert_freq(self, loc: int, item): freq = self.freq return freq - @doc(NDArrayBackedExtensionIndex.delete) def delete(self, loc) -> Self: + """ + Make new Index with passed location(-s) deleted. + + Parameters + ---------- + loc : int or list of int + Location of item(-s) to delete. Use a list of locations to delete + multiple items. If a slice is provided, the step must be 1. + + Returns + ------- + Index + Will be same type as self, except for RangeIndex. + """ result = super().delete(loc) result._data._freq = self._get_delete_freq(loc) return result - @doc(NDArrayBackedExtensionIndex.insert) def insert(self, loc: int, item): + """ + Make new Index inserting new item at location. + + Follows Python list.insert semantics for negative values. Only at + least one of the index/item pairs must be specified. + + Parameters + ---------- + loc : int + item : object + + Returns + ------- + Index + """ result = super().insert(loc, item) if isinstance(result, type(self)): # i.e. parent class method did not cast @@ -833,7 +926,6 @@ def insert(self, loc: int, item): # -------------------------------------------------------------------- # NDArray-Like Methods - @Appender(_index_shared_docs["take"] % _index_doc_kwargs) def take( self, indices, @@ -842,6 +934,32 @@ def take( fill_value=None, **kwargs, ) -> Self: + """ + Return a new Index of the values selected by the indices. + + For internal compatibility with numpy arrays. + + Parameters + ---------- + indices : array-like + Indices to be taken. + axis : int, optional + The axis over which to select values. Always 0. + allow_fill : bool, default True + fill_value : scalar, default None + If allow_fill=True and fill_value is not None, this value is used + instead of raising if the index is out of bounds. + + Returns + ------- + Index + An element of same type as self. + + See Also + -------- + numpy.ndarray.take : Return an array formed from the elements of a + at the given indices. + """ nv.validate_take((), kwargs) indices = np.asarray(indices, dtype=np.intp) From 8fd7c662ca2cceed002fba24c8eda06a9e14fc46 Mon Sep 17 00:00:00 2001 From: Jixun Sun <160219251+AnonToky@users.noreply.github.com> Date: Wed, 19 Nov 2025 22:36:27 +0800 Subject: [PATCH 06/12] Update --- pandas/core/indexes/datetimelike.py | 54 +++++++++++++++++++++++++++-- 1 file changed, 51 insertions(+), 3 deletions(-) diff --git a/pandas/core/indexes/datetimelike.py b/pandas/core/indexes/datetimelike.py index f1d324fec697c..105672f371526 100644 --- a/pandas/core/indexes/datetimelike.py +++ b/pandas/core/indexes/datetimelike.py @@ -89,7 +89,7 @@ class DatetimeIndexOpsMixin(NDArrayBackedExtensionIndex, ABC): _data: DatetimeArray | TimedeltaArray | PeriodArray def mean(self, *, skipna: bool = True, axis: int | None = 0): - """ + """ Return the mean value of the Array. Parameters @@ -103,9 +103,25 @@ def mean(self, *, skipna: bool = True, axis: int | None = 0): ------- scalar Timestamp or Timedelta. + + See Also + -------- + DatetimeIndex.median : Return the median of the index. + DatetimeIndex.sum : Sum of the values in the index. + DatetimeIndex.inferred_freq : Attempt to infer frequency from values. + + Examples + -------- + >>> import pandas as pd + >>> idx = pd.date_range("2020-01-01", periods=3) + >>> idx + DatetimeIndex(['2020-01-01', '2020-01-02', '2020-01-03'], + dtype='datetime64[ns]', freq='D') + >>> idx.mean() + Timestamp('2020-01-02 00:00:00') """ return self._data.mean(skipna=skipna, axis=axis) - + @property def freq(self) -> BaseOffset | None: """ @@ -149,6 +165,24 @@ def asi8(self) -> npt.NDArray[np.int64]: def freqstr(self) -> str: """ Return the frequency string if it is set, otherwise None. + + Returns + ------- + str or None + Frequency string such as 'D', 'H', etc., or None. + + See Also + -------- + DatetimeIndex.freq : The offset object for the frequency. + PeriodIndex.freq : Return the frequency object for PeriodIndex. + DatetimeIndex.inferred_freq : Attempt to infer frequency from values. + + Examples + -------- + >>> import pandas as pd + >>> idx = pd.date_range("2020-01-01", periods=3, freq="D") + >>> idx.freqstr + 'D' """ from pandas import PeriodIndex @@ -583,7 +617,7 @@ def shift(self, periods: int = 1, freq=None) -> Self: ) return type(self)._simple_new(result, name=self.name) - @cache_readonly + @cache_readonly def inferred_freq(self) -> str | None: """ Tries to return a string representing a frequency guess generated by infer_freq. @@ -591,6 +625,20 @@ def inferred_freq(self) -> str | None: Returns ------- str or None + Inferred frequency string (e.g. 'D', 'H') or None if it cannot be inferred. + + See Also + -------- + DatetimeIndex.freqstr : Readable frequency string. + DatetimeIndex.freq : The offset object for the frequency. + pandas.infer_freq : Lower-level frequency inference utility. + + Examples + -------- + >>> import pandas as pd + >>> idx = pd.to_datetime(['2020-01-01', '2020-01-02', '2020-01-03']) + >>> idx.inferred_freq + 'D' """ return self._data.inferred_freq From 3d9ad61e3fccf600ff7b521307c6c5763701d6ae Mon Sep 17 00:00:00 2001 From: Jixun Sun <160219251+AnonToky@users.noreply.github.com> Date: Wed, 19 Nov 2025 22:42:15 +0800 Subject: [PATCH 07/12] Refactor mean and inferred_freq methods documentation --- pandas/core/indexes/datetimelike.py | 54 ++--------------------------- 1 file changed, 3 insertions(+), 51 deletions(-) diff --git a/pandas/core/indexes/datetimelike.py b/pandas/core/indexes/datetimelike.py index 105672f371526..f1d324fec697c 100644 --- a/pandas/core/indexes/datetimelike.py +++ b/pandas/core/indexes/datetimelike.py @@ -89,7 +89,7 @@ class DatetimeIndexOpsMixin(NDArrayBackedExtensionIndex, ABC): _data: DatetimeArray | TimedeltaArray | PeriodArray def mean(self, *, skipna: bool = True, axis: int | None = 0): - """ + """ Return the mean value of the Array. Parameters @@ -103,25 +103,9 @@ def mean(self, *, skipna: bool = True, axis: int | None = 0): ------- scalar Timestamp or Timedelta. - - See Also - -------- - DatetimeIndex.median : Return the median of the index. - DatetimeIndex.sum : Sum of the values in the index. - DatetimeIndex.inferred_freq : Attempt to infer frequency from values. - - Examples - -------- - >>> import pandas as pd - >>> idx = pd.date_range("2020-01-01", periods=3) - >>> idx - DatetimeIndex(['2020-01-01', '2020-01-02', '2020-01-03'], - dtype='datetime64[ns]', freq='D') - >>> idx.mean() - Timestamp('2020-01-02 00:00:00') """ return self._data.mean(skipna=skipna, axis=axis) - + @property def freq(self) -> BaseOffset | None: """ @@ -165,24 +149,6 @@ def asi8(self) -> npt.NDArray[np.int64]: def freqstr(self) -> str: """ Return the frequency string if it is set, otherwise None. - - Returns - ------- - str or None - Frequency string such as 'D', 'H', etc., or None. - - See Also - -------- - DatetimeIndex.freq : The offset object for the frequency. - PeriodIndex.freq : Return the frequency object for PeriodIndex. - DatetimeIndex.inferred_freq : Attempt to infer frequency from values. - - Examples - -------- - >>> import pandas as pd - >>> idx = pd.date_range("2020-01-01", periods=3, freq="D") - >>> idx.freqstr - 'D' """ from pandas import PeriodIndex @@ -617,7 +583,7 @@ def shift(self, periods: int = 1, freq=None) -> Self: ) return type(self)._simple_new(result, name=self.name) - @cache_readonly + @cache_readonly def inferred_freq(self) -> str | None: """ Tries to return a string representing a frequency guess generated by infer_freq. @@ -625,20 +591,6 @@ def inferred_freq(self) -> str | None: Returns ------- str or None - Inferred frequency string (e.g. 'D', 'H') or None if it cannot be inferred. - - See Also - -------- - DatetimeIndex.freqstr : Readable frequency string. - DatetimeIndex.freq : The offset object for the frequency. - pandas.infer_freq : Lower-level frequency inference utility. - - Examples - -------- - >>> import pandas as pd - >>> idx = pd.to_datetime(['2020-01-01', '2020-01-02', '2020-01-03']) - >>> idx.inferred_freq - 'D' """ return self._data.inferred_freq From 1ec3cdc09079f78e85d51404aa760c61bae114c5 Mon Sep 17 00:00:00 2001 From: Jixun Sun <160219251+AnonToky@users.noreply.github.com> Date: Wed, 19 Nov 2025 23:22:49 +0800 Subject: [PATCH 08/12] Update datetimelike.py --- pandas/core/indexes/datetimelike.py | 42 +++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/pandas/core/indexes/datetimelike.py b/pandas/core/indexes/datetimelike.py index f1d324fec697c..e001f3a0ba596 100644 --- a/pandas/core/indexes/datetimelike.py +++ b/pandas/core/indexes/datetimelike.py @@ -36,7 +36,9 @@ NullFrequencyError, ) from pandas.util._decorators import ( + Appender, cache_readonly, + doc, ) from pandas.core.dtypes.common import ( @@ -55,10 +57,12 @@ PeriodArray, TimedeltaArray, ) +from pandas.core.arrays.datetimelike import DatetimeLikeArrayMixin import pandas.core.common as com import pandas.core.indexes.base as ibase from pandas.core.indexes.base import ( Index, + _index_shared_docs, ) from pandas.core.indexes.extension import NDArrayBackedExtensionIndex from pandas.core.indexes.range import RangeIndex @@ -103,6 +107,21 @@ def mean(self, *, skipna: bool = True, axis: int | None = 0): ------- scalar Timestamp or Timedelta. + + See Also + -------- + numpy.ndarray.mean : Returns the average of the array elements. + Series.mean : Return the mean value in a Series. + + Examples + -------- + >>> idx = pd.date_range('2023-01-01', periods=3) + >>> idx.mean() + Timestamp('2023-01-02 00:00:00') + + >>> idx = pd.to_timedelta([1, 2, 3], unit='D') + >>> idx.mean() + Timedelta('2 days 00:00:00') """ return self._data.mean(skipna=skipna, axis=axis) @@ -149,6 +168,18 @@ def asi8(self) -> npt.NDArray[np.int64]: def freqstr(self) -> str: """ Return the frequency string if it is set, otherwise None. + + See Also + -------- + DatetimeIndex.freq : Return the frequency object if it is set, otherwise None. + DatetimeIndex.inferred_freq : Tries to return a string representing a frequency + guess generated by infer_freq. + + Examples + -------- + >>> idx = pd.date_range('2023-01-01', periods=3, freq='D') + >>> idx.freqstr + 'D' """ from pandas import PeriodIndex @@ -591,6 +622,17 @@ def inferred_freq(self) -> str | None: Returns ------- str or None + + See Also + -------- + DatetimeIndex.freq : Return the frequency object if it is set, otherwise None. + DatetimeIndex.freqstr : Return the frequency string if it is set, otherwise None. + + Examples + -------- + >>> idx = pd.DatetimeIndex(['2018-01-01', '2018-01-03', '2018-01-05']) + >>> idx.inferred_freq + '2D' """ return self._data.inferred_freq From e1b76d9a5de3ae7ae232583c8de8823e98856064 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 19 Nov 2025 15:28:20 +0000 Subject: [PATCH 09/12] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- pandas/core/indexes/datetimelike.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/pandas/core/indexes/datetimelike.py b/pandas/core/indexes/datetimelike.py index e001f3a0ba596..2f7d24d4c053b 100644 --- a/pandas/core/indexes/datetimelike.py +++ b/pandas/core/indexes/datetimelike.py @@ -36,9 +36,7 @@ NullFrequencyError, ) from pandas.util._decorators import ( - Appender, cache_readonly, - doc, ) from pandas.core.dtypes.common import ( @@ -57,12 +55,10 @@ PeriodArray, TimedeltaArray, ) -from pandas.core.arrays.datetimelike import DatetimeLikeArrayMixin import pandas.core.common as com import pandas.core.indexes.base as ibase from pandas.core.indexes.base import ( Index, - _index_shared_docs, ) from pandas.core.indexes.extension import NDArrayBackedExtensionIndex from pandas.core.indexes.range import RangeIndex @@ -115,11 +111,11 @@ def mean(self, *, skipna: bool = True, axis: int | None = 0): Examples -------- - >>> idx = pd.date_range('2023-01-01', periods=3) + >>> idx = pd.date_range("2023-01-01", periods=3) >>> idx.mean() Timestamp('2023-01-02 00:00:00') - >>> idx = pd.to_timedelta([1, 2, 3], unit='D') + >>> idx = pd.to_timedelta([1, 2, 3], unit="D") >>> idx.mean() Timedelta('2 days 00:00:00') """ @@ -177,7 +173,7 @@ def freqstr(self) -> str: Examples -------- - >>> idx = pd.date_range('2023-01-01', periods=3, freq='D') + >>> idx = pd.date_range("2023-01-01", periods=3, freq="D") >>> idx.freqstr 'D' """ @@ -630,7 +626,7 @@ def inferred_freq(self) -> str | None: Examples -------- - >>> idx = pd.DatetimeIndex(['2018-01-01', '2018-01-03', '2018-01-05']) + >>> idx = pd.DatetimeIndex(["2018-01-01", "2018-01-03", "2018-01-05"]) >>> idx.inferred_freq '2D' """ From 08446fa48737740b580c03cd58c89ab94ffdff23 Mon Sep 17 00:00:00 2001 From: Jixun Sun <160219251+AnonToky@users.noreply.github.com> Date: Wed, 19 Nov 2025 23:31:09 +0800 Subject: [PATCH 10/12] to fix line too long --- pandas/core/indexes/datetimelike.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pandas/core/indexes/datetimelike.py b/pandas/core/indexes/datetimelike.py index 2f7d24d4c053b..02a55150dcb85 100644 --- a/pandas/core/indexes/datetimelike.py +++ b/pandas/core/indexes/datetimelike.py @@ -622,7 +622,8 @@ def inferred_freq(self) -> str | None: See Also -------- DatetimeIndex.freq : Return the frequency object if it is set, otherwise None. - DatetimeIndex.freqstr : Return the frequency string if it is set, otherwise None. + DatetimeIndex.freqstr : + Return the frequency string if it is set, otherwise None. Examples -------- From 4d1e0df7beadd3c70a874389738b87786a924cf8 Mon Sep 17 00:00:00 2001 From: Jixun Sun <160219251+AnonToky@users.noreply.github.com> Date: Wed, 19 Nov 2025 23:35:13 +0800 Subject: [PATCH 11/12] Update datetimelike.py --- pandas/core/indexes/datetimelike.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandas/core/indexes/datetimelike.py b/pandas/core/indexes/datetimelike.py index 02a55150dcb85..7fdf955442dfe 100644 --- a/pandas/core/indexes/datetimelike.py +++ b/pandas/core/indexes/datetimelike.py @@ -622,8 +622,8 @@ def inferred_freq(self) -> str | None: See Also -------- DatetimeIndex.freq : Return the frequency object if it is set, otherwise None. - DatetimeIndex.freqstr : - Return the frequency string if it is set, otherwise None. + DatetimeIndex.freqstr : Return the frequency string + if it is set, otherwise None. Examples -------- From 3dfbdcccb292f0146e6dec8870d5581739acb204 Mon Sep 17 00:00:00 2001 From: Jixun Sun <160219251+AnonToky@users.noreply.github.com> Date: Wed, 19 Nov 2025 23:40:45 +0800 Subject: [PATCH 12/12] Update datetimelike.py --- pandas/core/indexes/datetimelike.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pandas/core/indexes/datetimelike.py b/pandas/core/indexes/datetimelike.py index 7fdf955442dfe..11e71a80b9dee 100644 --- a/pandas/core/indexes/datetimelike.py +++ b/pandas/core/indexes/datetimelike.py @@ -622,8 +622,7 @@ def inferred_freq(self) -> str | None: See Also -------- DatetimeIndex.freq : Return the frequency object if it is set, otherwise None. - DatetimeIndex.freqstr : Return the frequency string - if it is set, otherwise None. + DatetimeIndex.freqstr : Return the frequency string if it is set. Examples --------