Skip to content

DOC: Fix some docstring validation errors #59698 #59713

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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