Skip to content

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

Merged
merged 4 commits into from
Nov 24, 2021
Merged

DOC: timedelta return type #44592

merged 4 commits into from
Nov 24, 2021

Conversation

loicdiridollou
Copy link
Contributor

@@ -68,7 +68,7 @@ def to_timedelta(arg, unit=None, errors="raise"):

Returns
-------
timedelta64 or numpy.array of timedelta64
Timedelta or TimedeltaIndex of timedelta64
Copy link
Member

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

@mroeschke mroeschke added Docs Timedelta Timedelta data type labels Nov 23, 2021

- list-like: TimedeltaIndex of timedelta64 dtype
- Series: Series of timedelta64 dtype
- Timedelta: Timedelta
Copy link
Member

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.

Copy link
Contributor Author

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

@mroeschke mroeschke merged commit fb86932 into pandas-dev:master Nov 24, 2021
@mroeschke
Copy link
Member

Thanks @loicdiridollou! Awesome job. Happy to have more of these doc issues addressed!

@loicdiridollou loicdiridollou deleted the timedelta_doc branch November 25, 2021 20:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Docs Timedelta Timedelta data type
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DOC: timedelta return type
2 participants