Skip to content

DOC: fix SA01, ES01 for pandas.Timedelta.to_timedelta64 #59860

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
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 0 additions & 1 deletion ci/code_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ 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_timedelta64 SA01" \
-i "pandas.TimedeltaIndex.to_pytimedelta RT03,SA01" \
-i "pandas.Timestamp.max PR02" \
-i "pandas.Timestamp.min PR02" \
Expand Down
12 changes: 12 additions & 0 deletions pandas/_libs/tslibs/timedeltas.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1411,6 +1411,18 @@ cdef class _Timedelta(timedelta):
"""
Return a numpy.timedelta64 object with 'ns' precision.

Since NumPy uses `timedelta64` objects for its time operations, converting
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Since NumPy uses `timedelta64` objects for its time operations, converting
Since NumPy uses ``timedelta64`` objects for its time operations, converting

And could you use double backticks consistently here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah. its regarding sphinx documentation I believe. Learnt about it couple of days back.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done!

a pandas `Timedelta` into a NumPy `timedelta64` provides seamless integration
between the two libraries, especially when working in environments that
heavily rely on NumPy for array-based calculations.

See Also
--------
to_timedelta : Convert argument to timedelta.
numpy.timedelta64 : A NumPy object for time duration.
Timedelta : Represents a duration, the difference between two dates
or times.

Examples
--------
>>> td = pd.Timedelta('3D')
Expand Down
Loading