-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
DOC: tail works even if n > length of DataFrame #46079
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
Comments
I strongly disagree on exception. This follows python's core logic: >>> a = [0, 1]
>>> a[:5]
[0, 1] Doc edits generally welcome if they make things more explicit. |
yep no exception is warranted |
Working fine |
I think you have misunderstood. I am not calling for an exception to be raised, I am asking that the documentation state that no exception is raised and state what the behaviour actually is (returning the entire df). I was stating that someone reading the documentation right now has no clue what the edge case behaviour is, and some clarification would be a value add to the documentation. |
Hi. I would like to get on this issue. Could it be assigned to me? |
take |
Pandas version checks
main
hereLocation of the documentation
https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.tail.html
Documentation problem
It may be obvious to some, but if the
n
requested bytail()
is greater than the length of the DataFrame, you get the entire DataFrame and no errors are thrown, and this is not mentioned in the documentation. This is useful for me because I'm trying to plot only the last 70 data points of a dataframe but the dataframe might not have 70 values yet. I think it would be reasonable to assume that one implementation would throw an out-of-bounds style exception.Suggested fix for documentation
Add one line about how n > dataframe length is handled.
The text was updated successfully, but these errors were encountered: