-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Example for pandas.DataFrame.to_period docs #43967
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
Example for pandas.DataFrame.to_period docs #43967
Conversation
@MarcoGorelli Please review |
pandas/core/frame.py
Outdated
>>> df = pd.DataFrame( | ||
... {"y": [1, 2, 3]}, | ||
... index=pd.to_datetime( | ||
... [ | ||
... "2001-03-31 00:00:00", | ||
... "2002-05-31 00:00:00", | ||
... "2003-08-31 00:00:00", | ||
... ] | ||
... ), | ||
... ) |
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.
I don't think you need to construct an entire DataFrame, could you do idx = pd.to_datetime(...
and then show idx.to_period('M')
(likewise for Y)?
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.
Made the suggested changes. PTAL
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.
cool, thanks @oovk
Restarting CI - ping on green @oovk |
Thanks for the PR @oovk |
Doc improvement - added the example section for pandas.DataFrame.to_period