Skip to content

Feat/add to group dataframe() function#3000

Merged
dennisbader merged 16 commits intounit8co:masterfrom
Jaco-Pastorius:feat/add-to-group-dataframe()-function
Feb 7, 2026
Merged

Feat/add to group dataframe() function#3000
dennisbader merged 16 commits intounit8co:masterfrom
Jaco-Pastorius:feat/add-to-group-dataframe()-function

Conversation

@Jaco-Pastorius
Copy link
Copy Markdown
Contributor

@Jaco-Pastorius Jaco-Pastorius commented Jan 28, 2026

Checklist before merging this PR:

  • Mentioned all issues that this PR fixes or addresses.
  • Summarized the updates of this PR under Summary.
  • Added an entry under Unreleased in the Changelog.

Fixes #2965.

Summary

  • Added to_group_dataframe()function that takes a list of series as an input and returns a long format dataframe.
  • Added support for static covariates and metatada in the TimeSeries.to_dataframe() method. Those can be added as columns in the result dataframe.
  • Two new arguments for the TimeSeries.to_dataframe() method control the addition of metadata and static covariates.
  • Component level static covariates are also supported in to_group_dataframe() and TimeSeries.to_dataframe()

Other Information

A new feature request should be added to add component level static covariate in from_group_dataframe()

@review-notebook-app
Copy link
Copy Markdown

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@codecov
Copy link
Copy Markdown

codecov Bot commented Jan 28, 2026

Codecov Report

❌ Patch coverage is 96.29630% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 95.58%. Comparing base (d92bf93) to head (23f9281).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
darts/timeseries.py 96.22% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3000      +/-   ##
==========================================
- Coverage   95.64%   95.58%   -0.07%     
==========================================
  Files         156      156              
  Lines       16946    16997      +51     
==========================================
+ Hits        16208    16246      +38     
- Misses        738      751      +13     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Collaborator

@jakubchlapek jakubchlapek left a comment

Choose a reason for hiding this comment

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

thanks for this PR @Jaco-Pastorius, it looks very nice! I added some suggestions regarding handling of stochastic timeseries, and some personal nitpicks (forgive me pls) but it looks good, let me know what you think

Comment thread darts/timeseries.py Outdated
Comment thread darts/timeseries.py Outdated
Comment thread darts/timeseries.py
Comment thread darts/timeseries.py
Comment thread darts/timeseries.py Outdated
Comment thread darts/timeseries.py Outdated
Comment thread darts/timeseries.py Outdated
Comment thread darts/timeseries.py Outdated
@Jaco-Pastorius
Copy link
Copy Markdown
Contributor Author

Hey @jakubchlapek, thanks a lot for your review it all makes sense to me !

I've also added some tests in my latest commit as some lines weren't covered.

I also added an argument in to_group_dataframe called add_group_col that gives the user the option to add a group column in the resulting long format data frame in case they don't have any static covariates or metadata that could be used for groups. Let me know what you think about it !

Cheers

Copy link
Copy Markdown
Collaborator

@jakubchlapek jakubchlapek left a comment

Choose a reason for hiding this comment

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

Hey @Jaco-Pastorius , two very small clarifications, i've commited them so you don't have to, but besides that it LGTM, unless @dennisbader has any nitpicks haha. Thanks for this PR, I think the add_group_col is very neat, cool idea :)
Cheers

Comment thread darts/timeseries.py Outdated
Comment thread darts/timeseries.py Outdated
Copy link
Copy Markdown
Collaborator

@dennisbader dennisbader left a comment

Choose a reason for hiding this comment

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

Thanks a lot @Jaco-Pastorius for another great PR 🥳 🚀
It simplifies things quite a lot for the user that now we handle this under the hood 💯

I pushed some minor changes, main differences:

  • changed the column naming for output component-specific static covaraites to "{static_cov_column}_{series_column}"
  • added some unit tests for to_dataframe()
  • some docs rephrasing

I'll merge once all tests have passed 🚀

@dennisbader dennisbader merged commit d3a57dd into unit8co:master Feb 7, 2026
9 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.

[FEATURE] Add function to_group_dataframe() to generate long DataFrame from list of TimeSeries

3 participants