Skip to content

DOC: Add note for tail/head when n is larger then length of DataFrame #46114

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

Closed
wants to merge 2 commits into from
Closed

Conversation

bjiro
Copy link

@bjiro bjiro commented Feb 22, 2022

bjiro and others added 2 commits February 22, 2022 14:52
Added documentation on head and tail methods. Parameter n can be larger than the object size.
@pep8speaks
Copy link

Hello @benjamrio! Thanks for opening this PR. We checked the lines you've touched for PEP 8 issues, and found:

Line 5165:80: W291 trailing whitespace
Line 5241:80: W291 trailing whitespace

@@ -5162,6 +5162,9 @@ def head(self: NDFrameT, n: int = 5) -> NDFrameT:
For negative values of `n`, this function returns all rows except
the last `n` rows, equivalent to ``df[:-n]``.
Copy link
Member

Choose a reason for hiding this comment

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

Maybe add something like if n is larger than the lenght of the DataFrame, the whole DataFrame is returned.

You can run pre-commit locally to avoid the pep8 issues

Copy link
Member

Choose a reason for hiding this comment

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

@phofl phofl changed the title Update generic.py documentation DOC: Add note for tail/head when n is larger then length of DataFrame Feb 22, 2022
@jreback jreback added Docs Indexing Related to indexing on series/frames, not to indexes themselves labels Feb 27, 2022
@github-actions
Copy link
Contributor

This pull request is stale because it has been open for thirty days with no activity. Please update and respond to this comment if you're still interested in working on this.

@github-actions github-actions bot added the Stale label Mar 30, 2022
@mroeschke
Copy link
Member

Thanks for the pull request, but this was addressed by #46466. Closing.

@mroeschke mroeschke closed this Mar 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Docs Indexing Related to indexing on series/frames, not to indexes themselves Stale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DOC: tail works even if n > length of DataFrame
6 participants