diff --git a/doc/source/whatsnew/v3.0.0.rst b/doc/source/whatsnew/v3.0.0.rst index ef06f57f611d1..9dd85642be127 100644 --- a/doc/source/whatsnew/v3.0.0.rst +++ b/doc/source/whatsnew/v3.0.0.rst @@ -46,10 +46,11 @@ Other enhancements - :meth:`DataFrame.fillna` and :meth:`Series.fillna` can now accept ``value=None``; for non-object dtype the corresponding NA value will be used (:issue:`57723`) - :meth:`DataFrame.pivot_table` and :func:`pivot_table` now allow the passing of keyword arguments to ``aggfunc`` through ``**kwargs`` (:issue:`57884`) - :meth:`Series.cummin` and :meth:`Series.cummax` now supports :class:`CategoricalDtype` (:issue:`52335`) +- :meth:`Series.dt.day_of_week` now returns ``int8`` dtype (:issue:`58185`) - :meth:`Series.plot` now correctly handle the ``ylabel`` parameter for pie charts, allowing for explicit control over the y-axis label (:issue:`58239`) - Restore support for reading Stata 104-format and enable reading 103-format dta files (:issue:`58554`) - Support reading Stata 110-format (Stata 7) dta files (:issue:`47176`) - +- .. --------------------------------------------------------------------------- .. _whatsnew_300.notable_bug_fixes: diff --git a/pandas/tests/series/accessors/test_dt_accessor.py b/pandas/tests/series/accessors/test_dt_accessor.py index 49ae0a60e6608..1a06e6c466628 100644 --- a/pandas/tests/series/accessors/test_dt_accessor.py +++ b/pandas/tests/series/accessors/test_dt_accessor.py @@ -136,6 +136,13 @@ def test_dt_namespace_accessor_datetime64(self, freq): expected = Series(exp_values, index=ser.index, name="xxx") tm.assert_series_equal(result, expected) + def test_day_of_week_return_type(self): + # GH #58185 + ser = Series( + ["2024-01-01", "2024-01-02", "2024-01-03"], dtype="datetime64[us]" + ).dt.day_of_week + assert ser.dtype == "int8" + def test_dt_namespace_accessor_datetime64tz(self): # GH#7207, GH#11128 # test .dt namespace accessor