Skip to content

Commit 50fa282

Browse files
add description to whatsnew and revert unwanted changes in datetimearray docstring
make pre-commit happy
1 parent 229804f commit 50fa282

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

doc/source/whatsnew/v3.0.0.rst

+1
Original file line numberDiff line numberDiff line change
@@ -554,6 +554,7 @@ MultiIndex
554554
- :func:`DataFrame.loc` with ``axis=0`` and :class:`MultiIndex` when setting a value adds extra columns (:issue:`58116`)
555555
- :meth:`DataFrame.melt` would not accept multiple names in ``var_name`` when the columns were a :class:`MultiIndex` (:issue:`58033`)
556556
- :meth:`MultiIndex.insert` would not insert NA value correctly at unified location of index -1 (:issue:`59003`)
557+
- :func:`MultiIndex.get_level_values` accessing a :class:`DatetimeIndex` does not carry the frequency attribute along (:issue:`58327`, :issue:`57949`)
557558
-
558559

559560
I/O

pandas/core/arrays/datetimelike.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -1769,7 +1769,7 @@ def strftime(self, date_format: str) -> npt.NDArray[np.object_]:
17691769
----------
17701770
freq : str or Offset
17711771
The frequency level to {op} the index to. Must be a fixed
1772-
frequency like 'S' (second) not 'ME' (month end). See
1772+
frequency like 's' (second) not 'ME' (month end). See
17731773
:ref:`frequency aliases <timeseries.offset_aliases>` for
17741774
a list of possible `freq` values.
17751775
ambiguous : 'infer', bool-ndarray, 'NaT', default 'raise'
@@ -1807,6 +1807,11 @@ def strftime(self, date_format: str) -> npt.NDArray[np.object_]:
18071807
------
18081808
ValueError if the `freq` cannot be converted.
18091809
1810+
See Also
1811+
--------
1812+
DatetimeIndex.floor : Perform floor operation on the data to the specified `freq`.
1813+
DatetimeIndex.snap : Snap time stamps to nearest occurring frequency.
1814+
18101815
Notes
18111816
-----
18121817
If the timestamps have a timezone, {op}ing will take place relative to the

pandas/tests/indexes/multi/test_get_level_values.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,7 @@ def test_values_loses_freq_of_underlying_index():
126126

127127
def test_get_level_values_gets_frequency_correctly():
128128
# GH#57949 GH#58327
129-
datetime_index = pd.date_range(
130-
start=pd.to_datetime("1/1/2018"), periods=4, freq="YS"
131-
)
129+
datetime_index = date_range(start=pd.to_datetime("1/1/2018"), periods=4, freq="YS")
132130
other_index = ["A"]
133131
multi_index = MultiIndex.from_product([datetime_index, other_index])
134132

0 commit comments

Comments
 (0)