Skip to content

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

Conversation

oovk
Copy link
Contributor

@oovk oovk commented Oct 11, 2021

  • tests added / passed
  • Ensure all linting tests pass, see here for how to run them
  • whatsnew entry
    Doc improvement - added the example section for pandas.DataFrame.to_period

@oovk
Copy link
Contributor Author

oovk commented Oct 11, 2021

@MarcoGorelli Please review

Comment on lines 10509 to 10518
>>> 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",
... ]
... ),
... )
Copy link
Member

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)?

Copy link
Contributor Author

@oovk oovk Oct 11, 2021

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

Copy link
Member

@MarcoGorelli MarcoGorelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool, thanks @oovk

@lithomas1 lithomas1 added the Docs label Oct 12, 2021
@lithomas1 lithomas1 added this to the 1.4 milestone Oct 12, 2021
@alimcmaster1
Copy link
Member

Restarting CI - ping on green @oovk

@oovk
Copy link
Contributor Author

oovk commented Oct 14, 2021

@alimcmaster1

@alimcmaster1 alimcmaster1 changed the title Added the example to pandas.DataFrame.to_period docs Example for pandas.DataFrame.to_period docs Oct 14, 2021
@alimcmaster1 alimcmaster1 merged commit ef49a8e into pandas-dev:master Oct 14, 2021
@alimcmaster1
Copy link
Member

Thanks for the PR @oovk

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants