Skip to content

Commit

Permalink
DOC: Fix some docstring validation errors pandas-dev#59698 (pandas-de…
Browse files Browse the repository at this point in the history
…v#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
  • Loading branch information
amanlai authored Sep 6, 2024
1 parent 6c30aa2 commit 3a45265
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 7 deletions.
4 changes: 0 additions & 4 deletions ci/code_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
-i "pandas.Series.dt.day_name PR01,PR02" \
-i "pandas.Series.dt.floor PR01,PR02" \
-i "pandas.Series.dt.freq GL08" \
-i "pandas.Series.dt.microseconds SA01" \
-i "pandas.Series.dt.month_name PR01,PR02" \
-i "pandas.Series.dt.nanoseconds SA01" \
-i "pandas.Series.dt.normalize PR01" \
Expand All @@ -113,12 +112,9 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
-i "pandas.Timedelta.max PR02" \
-i "pandas.Timedelta.min PR02" \
-i "pandas.Timedelta.resolution PR02" \
-i "pandas.Timedelta.to_numpy PR01" \
-i "pandas.Timedelta.to_timedelta64 SA01" \
-i "pandas.Timedelta.total_seconds SA01" \
-i "pandas.Timedelta.view SA01" \
-i "pandas.TimedeltaIndex.components SA01" \
-i "pandas.TimedeltaIndex.microseconds SA01" \
-i "pandas.TimedeltaIndex.nanoseconds SA01" \
-i "pandas.TimedeltaIndex.seconds SA01" \
-i "pandas.TimedeltaIndex.to_pytimedelta RT03,SA01" \
Expand Down
13 changes: 10 additions & 3 deletions pandas/_libs/tslibs/timedeltas.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1421,9 +1421,16 @@ cdef class _Timedelta(timedelta):
"""
Convert the Timedelta to a NumPy timedelta64.

This is an alias method for `Timedelta.to_timedelta64()`. The dtype and
copy parameters are available here only for compatibility. Their values
will not affect the return value.
This is an alias method for `Timedelta.to_timedelta64()`.

Parameters
----------
dtype : NoneType
It is available here only for compatibility. Its value will not
affect the return value.
copy : bool, default False
It is available here only for compatibility. Its value will not
affect the return value.

Returns
-------
Expand Down
12 changes: 12 additions & 0 deletions pandas/core/arrays/timedeltas.py
Original file line number Diff line number Diff line change
Expand Up @@ -876,6 +876,12 @@ def to_pytimedelta(self) -> npt.NDArray[np.object_]:
microseconds_docstring = textwrap.dedent(
"""Number of microseconds (>= 0 and less than 1 second) for each element.
See Also
--------
pd.Timedelta.microseconds : Number of microseconds (>= 0 and less than 1 second).
pd.Timedelta.to_pytimedelta.microseconds : Number of microseconds (>= 0 and less
than 1 second) of a datetime.timedelta.
Examples
--------
For Series:
Expand Down Expand Up @@ -955,6 +961,12 @@ def components(self) -> DataFrame:
-------
DataFrame
See Also
--------
TimedeltaIndex.total_seconds : Return total duration expressed in seconds.
Timedelta.components : Return a components namedtuple-like of a single
timedelta.
Examples
--------
>>> tdelta_idx = pd.to_timedelta(["1 day 3 min 2 us 42 ns"])
Expand Down

0 comments on commit 3a45265

Please sign in to comment.