Skip to content
2 changes: 1 addition & 1 deletion ci/code_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
pandas.Period.ordinal\
pandas.PeriodIndex.freq\
pandas.PeriodIndex.qyear\
pandas.Series.dt\
pandas.Series.dt.as_unit\
pandas.Series.dt.freq\
pandas.Series.dt.qyear\
Expand Down Expand Up @@ -437,6 +436,7 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
pandas.Series.cat.rename_categories\
pandas.Series.cat.reorder_categories\
pandas.Series.cat.set_categories\
pandas.Series.dt `# Accessors are implemented as classes, but we do not document the Parameters section` \
pandas.Series.dt.as_unit\
pandas.Series.dt.ceil\
pandas.Series.dt.day_name\
Expand Down
38 changes: 38 additions & 0 deletions pandas/core/indexes/accessors.py
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,44 @@ class PeriodProperties(Properties):
class CombinedDatetimelikeProperties(
DatetimeProperties, TimedeltaProperties, PeriodProperties
):
"""
Accessor object for Series values' datetime-like, timedelta and period properties.

See Also
--------
DatetimeIndex : Index of datetime64 data.

Examples
--------
>>> dates = pd.Series(
... ["2024-01-01", "2024-01-15", "2024-02-5"], dtype="datetime64[ns]"
... )
>>> dates.dt.day
0 1
1 15
2 5
dtype: int32
>>> dates.dt.month
0 1
1 1
2 2
dtype: int32

>>> dates = pd.Series(
... ["2024-01-01", "2024-01-15", "2024-02-5"], dtype="datetime64[ns, UTC]"
... )
>>> dates.dt.day
0 1
1 15
2 5
dtype: int32
>>> dates.dt.month
0 1
1 1
2 2
dtype: int32
"""

def __new__(cls, data: Series): # pyright: ignore[reportInconsistentConstructor]
# CombinedDatetimelikeProperties isn't really instantiated. Instead
# we need to choose which parent (datetime or timedelta) is
Expand Down