-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
DOC: DataFrame.last() needs the index to be sorted to deliver the expected results #38000
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
Hi thanks for your report. You are right, the documentation should be better here. Additionally I am wondering if we should raise when the Index is unsorted. PS: Could you adjust your title to reflect the problem a bit better? |
Can I take up this issue and add this to the documentation? @phofl |
Yes, sure! |
Oh thanks @alejsm |
Do I need to just add the part in the documentation or also add a error when the index is not sorted, if yes, what should be the type of the error? @phofl |
Location of the documentation
https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.last.html
Documentation problem
For the method to work it is needed that the DatetimeIndex of the dataframe is sorted, otherwise it will notwork.
Example:
returns all the rows in the DataFrame
Suggested fix for documentation
It should be mentioned that for the last() method to work, the DatetimeIndex must be sorted, or the user may think that there is a bug in the function.
The text was updated successfully, but these errors were encountered: