-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
DOC: timedelta return type #44592
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
DOC: timedelta return type #44592
Conversation
loicdiridollou
commented
Nov 23, 2021
- closes DOC: timedelta return type #42316
- [NA] tests added / passed
- Ensure all linting tests pass, see here for how to run them
- [NA] whatsnew entry
pandas/core/tools/timedeltas.py
Outdated
@@ -68,7 +68,7 @@ def to_timedelta(arg, unit=None, errors="raise"): | |||
|
|||
Returns | |||
------- | |||
timedelta64 or numpy.array of timedelta64 | |||
Timedelta or TimedeltaIndex of timedelta64 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can also return a Series of timedelta64[ns]
if a Series
is the input.
Would be great if you could organize this Returns
sections like the Returns
section of to_datetime
pandas/core/tools/timedeltas.py
Outdated
|
||
- list-like: TimedeltaIndex of timedelta64 dtype | ||
- Series: Series of timedelta64 dtype | ||
- Timedelta: Timedelta |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Could you summarize this and line below as - scalar: Timedelta
. scalar includes str
, datetime.timedelta
, np.timedelta64
, etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! I wasn't sure at first that Timedelta was considered a scalar but should have checked with pandas.api.types.is_scalar
, my mistake, it is fixed
Thanks @loicdiridollou! Awesome job. Happy to have more of these doc issues addressed! |