-
-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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: Improved the docstring of pandas.Series.dt.to_pytimedelta #20142
Changes from 2 commits
660fbb1
2aa395b
18d67b6
c490ef4
48ca62c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -157,6 +157,32 @@ class TimedeltaProperties(Properties): | |
""" | ||
|
||
def to_pytimedelta(self): | ||
""" | ||
Return array of Timedeltas as `datetime.timedelta`. | ||
|
||
Return an array of the Timedeltas in `datetime.timedelta` format with | ||
the same length as the original Series. | ||
|
||
Returns | ||
------- | ||
a : numpy.ndarray | ||
1D array containing data with `datetime.timedelta` type. | ||
|
||
Examples | ||
-------- | ||
>>> s = pd.Series(pd.to_timedelta(np.arange(5), unit='d')) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we need There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't seem to need the import, but to clarify things, I've added more to the description. |
||
>>> s | ||
0 0 days | ||
1 1 days | ||
2 2 days | ||
3 3 days | ||
4 4 days | ||
dtype: timedelta64[ns] | ||
>>> s.dt.to_pytimedelta() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you add a blank line before this case There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added. |
||
array([datetime.timedelta(0), datetime.timedelta(1), | ||
datetime.timedelta(2), datetime.timedelta(3), | ||
datetime.timedelta(4)], dtype=object) | ||
""" | ||
return self._get_values().to_pytimedelta() | ||
|
||
@property | ||
|
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.
Missing single-line summary in the beginning.
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.
Added.