drop_incomplete support in SeasonGrouper
- [x] Closes #10426
- [ ] Tests added
- [ ] User visible changes (including notable bug fixes) are documented in
whats-new.rst - [ ] New functions/methods are listed in
api.rst
SeasonGrouper Enhancements
Enhanced the SeasonGrouper class to support conditional omission of incomplete seasons—now aligned with behavior in SeasonResampler.
Summary of Changes
1. drop_incomplete Keyword Argument
- Introduced a new boolean parameter
drop_incomplete, defaulting toFalsefor backward compatibility. - Enables users to choose whether incomplete seasons should be excluded during grouping.
2. Revised factorize Method
- Core logic for dropping incomplete seasons has been moved into the
factorizemethod. - When
drop_incomplete=True, it:- Iterates over each year-series chunk.
- Verifies that all expected months in the season are present.
- Excludes any data for that season-year pair if months are missing.
3. Updated reset Method
- Ensures that the
drop_incompletesetting correctly propagates when resetting or re-initializing the grouper.
Thank you for opening this pull request! It may take us a few days to respond here, so thank you for being patient. If you have questions, some answers may be found in our contributing guidelines.
@dcherian the failing tests seems to be unrelated to changes in the PR, right?
Yes.
Apologies, I am quite busy at the moment and can only review this in two weeks.
@tomvothecoder if you happen to have tests for grouping with drop_incomplete, those would be very helpful here.