Skip to content

Commit 3a45265

Browse files
authored
DOC: Fix some docstring validation errors #59698 (#59713)
* fix some docstring errors * removed trailing whitespace * pd.Series.dt.microseconds has the same documentation as pd.TimedeltaIndex.microseconds and SA01 was cleared for both in the previous commit
1 parent 6c30aa2 commit 3a45265

File tree

3 files changed

+22
-7
lines changed

3 files changed

+22
-7
lines changed

ci/code_checks.sh

-4
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
9292
-i "pandas.Series.dt.day_name PR01,PR02" \
9393
-i "pandas.Series.dt.floor PR01,PR02" \
9494
-i "pandas.Series.dt.freq GL08" \
95-
-i "pandas.Series.dt.microseconds SA01" \
9695
-i "pandas.Series.dt.month_name PR01,PR02" \
9796
-i "pandas.Series.dt.nanoseconds SA01" \
9897
-i "pandas.Series.dt.normalize PR01" \
@@ -113,12 +112,9 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
113112
-i "pandas.Timedelta.max PR02" \
114113
-i "pandas.Timedelta.min PR02" \
115114
-i "pandas.Timedelta.resolution PR02" \
116-
-i "pandas.Timedelta.to_numpy PR01" \
117115
-i "pandas.Timedelta.to_timedelta64 SA01" \
118116
-i "pandas.Timedelta.total_seconds SA01" \
119117
-i "pandas.Timedelta.view SA01" \
120-
-i "pandas.TimedeltaIndex.components SA01" \
121-
-i "pandas.TimedeltaIndex.microseconds SA01" \
122118
-i "pandas.TimedeltaIndex.nanoseconds SA01" \
123119
-i "pandas.TimedeltaIndex.seconds SA01" \
124120
-i "pandas.TimedeltaIndex.to_pytimedelta RT03,SA01" \

pandas/_libs/tslibs/timedeltas.pyx

+10-3
Original file line numberDiff line numberDiff line change
@@ -1421,9 +1421,16 @@ cdef class _Timedelta(timedelta):
14211421
"""
14221422
Convert the Timedelta to a NumPy timedelta64.
14231423

1424-
This is an alias method for `Timedelta.to_timedelta64()`. The dtype and
1425-
copy parameters are available here only for compatibility. Their values
1426-
will not affect the return value.
1424+
This is an alias method for `Timedelta.to_timedelta64()`.
1425+
1426+
Parameters
1427+
----------
1428+
dtype : NoneType
1429+
It is available here only for compatibility. Its value will not
1430+
affect the return value.
1431+
copy : bool, default False
1432+
It is available here only for compatibility. Its value will not
1433+
affect the return value.
14271434

14281435
Returns
14291436
-------

pandas/core/arrays/timedeltas.py

+12
Original file line numberDiff line numberDiff line change
@@ -876,6 +876,12 @@ def to_pytimedelta(self) -> npt.NDArray[np.object_]:
876876
microseconds_docstring = textwrap.dedent(
877877
"""Number of microseconds (>= 0 and less than 1 second) for each element.
878878
879+
See Also
880+
--------
881+
pd.Timedelta.microseconds : Number of microseconds (>= 0 and less than 1 second).
882+
pd.Timedelta.to_pytimedelta.microseconds : Number of microseconds (>= 0 and less
883+
than 1 second) of a datetime.timedelta.
884+
879885
Examples
880886
--------
881887
For Series:
@@ -955,6 +961,12 @@ def components(self) -> DataFrame:
955961
-------
956962
DataFrame
957963
964+
See Also
965+
--------
966+
TimedeltaIndex.total_seconds : Return total duration expressed in seconds.
967+
Timedelta.components : Return a components namedtuple-like of a single
968+
timedelta.
969+
958970
Examples
959971
--------
960972
>>> tdelta_idx = pd.to_timedelta(["1 day 3 min 2 us 42 ns"])

0 commit comments

Comments
 (0)