-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Docstring changes to pandas.Series.dt.to_pydatetime #20198
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
Changes from 7 commits
6480b22
6a643fc
e4dbd78
5523dd5
c83eff0
04dbd04
4f73176
35ce553
0279ae8
d8fe91d
2dd734c
e010c13
34b4e99
932feff
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 |
---|---|---|
|
@@ -126,6 +126,29 @@ class DatetimeProperties(Properties): | |
""" | ||
|
||
def to_pydatetime(self): | ||
""" | ||
Return Series as a native Python datetime objects. | ||
|
||
Returns | ||
------- | ||
Series of object dtype | ||
|
||
See Also | ||
-------- | ||
pandas.DatetimeIndex.to_pydatetime : Convert a Timestamp object to a native | ||
Python datetime object. | ||
|
||
Examples | ||
-------- | ||
>>> s = pd.Series(pd.date_range('20180310', periods=2)) | ||
>>> s.head() | ||
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. head can be removed |
||
0 2018-03-10 | ||
1 2018-03-11 | ||
dtype: datetime64[ns] | ||
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. Unnecessary 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. Hi @datapythonista , 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. fixed it by just using >>> s 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. You can just do |
||
>>> s.dt.to_pydatetime() | ||
array([datetime.datetime(2018, 3, 10, 0, 0), | ||
datetime.datetime(2018, 3, 11, 0, 0)], dtype=object) | ||
""" | ||
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 gave up on a tz example since the repr for datetime w/ tz is so long. Wasn't able to make it look nice. |
||
return self._get_values().to_pydatetime() | ||
|
||
@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.
This is now referencing itself?
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.
check : https://pandas.pydata.org/pandas-docs/stable/generated/pandas.DatetimeIndex.to_pydatetime.html
and
https://pandas.pydata.org/pandas-docs/stable/generated/pandas.Series.dt.to_pydatetime.html
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.
Ah, sorry! Missed that this one was in
accessors.py
.