diff --git a/ci/code_checks.sh b/ci/code_checks.sh index 72678be1587f8..113469e89fc73 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -71,7 +71,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then -i ES01 `# For now it is ok if docstrings are missing the extended summary` \ -i "pandas.Series.dt PR01" `# Accessors are implemented as classes, but we do not document the Parameters section` \ -i "pandas.MultiIndex.reorder_levels RT03,SA01" \ - -i "pandas.MultiIndex.to_frame RT03" \ -i "pandas.NA SA01" \ -i "pandas.NaT SA01" \ -i "pandas.Period.freq GL08" \ @@ -152,7 +151,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then -i "pandas.Timedelta.to_timedelta64 SA01" \ -i "pandas.Timedelta.total_seconds SA01" \ -i "pandas.Timedelta.view SA01" \ - -i "pandas.TimedeltaIndex.as_unit RT03,SA01" \ -i "pandas.TimedeltaIndex.components SA01" \ -i "pandas.TimedeltaIndex.microseconds SA01" \ -i "pandas.TimedeltaIndex.nanoseconds SA01" \ diff --git a/pandas/core/indexes/datetimelike.py b/pandas/core/indexes/datetimelike.py index e1120466eaf83..8b316de30662c 100644 --- a/pandas/core/indexes/datetimelike.py +++ b/pandas/core/indexes/datetimelike.py @@ -441,6 +441,10 @@ def as_unit(self, unit: str) -> Self: """ Convert to a dtype with the given unit resolution. + This method is for converting the dtype of a ``DatetimeIndex`` or + ``TimedeltaIndex`` to a new dtype with the given unit + resolution/precision. + Parameters ---------- unit : {'s', 'ms', 'us', 'ns'} @@ -448,6 +452,14 @@ def as_unit(self, unit: str) -> Self: Returns ------- same type as self + Converted to the specified unit. + + See Also + -------- + Timestamp.as_unit : Convert to the given unit. + Timedelta.as_unit : Convert to the given unit. + DatetimeIndex.as_unit : Convert to the given unit. + TimedeltaIndex.as_unit : Convert to the given unit. Examples -------- diff --git a/pandas/core/indexes/multi.py b/pandas/core/indexes/multi.py index c3d4ad721c830..239b3f9d9afa1 100644 --- a/pandas/core/indexes/multi.py +++ b/pandas/core/indexes/multi.py @@ -1894,6 +1894,7 @@ def to_frame( Returns ------- DataFrame + DataFrame representation of the MultiIndex, with levels as columns. See Also --------