Skip to content

drop_incomplete support in SeasonGrouper #10436

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dhruvak001
Copy link

@dhruvak001 dhruvak001 commented Jun 21, 2025

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 to False for 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 factorize method.
  • 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_incomplete setting correctly propagates when resetting or re-initializing the grouper.

Copy link

welcome bot commented Jun 21, 2025

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.

(indices,) = mask.nonzero()
group_indices[code] = indices.tolist()
else:
year_adjusted = year.copy()
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there code in SeasonResampler we could reuse here?

Can you add a couple of tests please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support drop_incomplete kwarg with SeasonGrouper
2 participants