Skip to content

Added note in docs for giving the developer the option of choosing be… #45261

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 1 commit into from
Jan 8, 2022
Merged
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
19 changes: 19 additions & 0 deletions pandas/_libs/tslibs/timedeltas.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1246,10 +1246,29 @@ class Timedelta(_Timedelta):

Notes
-----
The constructor may take in either both values of value and unit or
kwargs as above. Either one of them must be used during initialization

The ``.value`` attribute is always in ns.

If the precision is higher than nanoseconds, the precision of the duration is
truncated to nanoseconds.

Examples
--------
Here we initialize Timedelta object with both value and unit

>>> td = pd.Timedelta(1, "d")
>>> td
Timedelta('1 days 00:00:00')

Here we initialize the Timedelta object with kwargs

>>> td2 = pd.Timedelta(days=1)
>>> td2
Timedelta('1 days 00:00:00')

We see that either way we get the same result
"""

def __new__(cls, object value=_no_input, unit=None, **kwargs):
Expand Down