Skip to content

Added an edge case handler and a test case for Series.first("#M") #52789

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 3 commits into from

Conversation

ivyrxr
Copy link

@ivyrxr ivyrxr commented Apr 19, 2023

As described in the above issue, first("1M") does not include timestamps of the last day of a month that are beyond "00:00:00". The problem happens to "2M", "3M", etc., where MonthEnd is being used.

To fix it, I added an if-statement in first() to check whether the offset variable is an instance of MonthEnd. If it is, the end date will be adjusted one day forward, and the returned range will end till the last timestamp before the end date.

I also added a test case in test_first_and_last.py and passed it.

@ivyrxr ivyrxr changed the title Added an edge case handler and a test case for first("#M") Added an edge case handler and a test case for Series.first("#M") Apr 19, 2023
@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 May 22, 2023
@mroeschke
Copy link
Member

Thanks for the pull request, but it appears to have gone stale. If interested in continuing, please merge in the main branch, address any review comments and/or failing tests, and we can reopen.

@mroeschke mroeschke closed this May 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants