Skip to content

Add DataFrame.partition_by/2 - #1163

Merged
akoutmos merged 1 commit into
elixir-explorer:mainfrom
georgeguimaraes:partition-by
Sep 26, 2026
Merged

akoutmos merged 1 commit into
elixir-explorer:mainfrom
georgeguimaraes:partition-by

Conversation

@georgeguimaraes

Copy link
Copy Markdown
Contributor

One dataframe per distinct combination of the given columns, in the order each combination first appears, backed by Polars' partition_by. Every piece keeps all the columns and a lazy frame is collected first.

Fitting one model per time series in a frame, or one per store or sensor, needs exactly this split, and the alternative today is distinct followed by one filter_with per key, which reads the frame once per group.

Splits a dataframe into one dataframe per distinct combination of the
given columns, in the order each combination first appears, through
Polars' partition_by. Lazy dataframes are collected first.
@akoutmos

Copy link
Copy Markdown
Contributor

Thank for another great contribution! I should have some bandwidth to review this next week and merge it in!

@georgeguimaraes

Copy link
Copy Markdown
Contributor Author

Sure, np. I needed this piece for https://github.com/georgeguimaraes/soothsayer and thought it would be a good one to contribute

@akoutmos akoutmos left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM!

@akoutmos
akoutmos merged commit 7b7d6d7 into elixir-explorer:main Sep 26, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants