Skip to content
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

fix: remove dataframe.columns name to avoid error with xarray #1938

Merged
merged 9 commits into from Aug 9, 2023

Conversation

madtoinou
Copy link
Collaborator

Fixes #1522.

Summary

xarray constructor raise an error when the Index containing the name of the columns has a name (which not necessarily the name of the index itself, even if it can be displayed as such). Simply setting this name to None solve the problem without impacting the attributes of the generated TimeSeries.

@codecov-commenter
Copy link

codecov-commenter commented Aug 7, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: -0.01% ⚠️

Comparison is base (60f2ec1) 93.87% compared to head (c241d64) 93.87%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1938      +/-   ##
==========================================
- Coverage   93.87%   93.87%   -0.01%     
==========================================
  Files         132      132              
  Lines       12673    12661      -12     
==========================================
- Hits        11897    11885      -12     
  Misses        776      776              
Files Changed Coverage Δ
darts/timeseries.py 92.67% <100.00%> (-0.04%) ⬇️

... and 5 files with indirect coverage changes

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

Copy link
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 @madtoinou , looks good 👍
Can you add a test and a changelog entry? Then we can merge.

Copy link
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.

I missed it before, but we need to make sure that we don't mutate the original df.columns.

darts/tests/test_timeseries.py Outdated Show resolved Hide resolved
darts/timeseries.py Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
Copy link
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.

💯 You can merge when the tests have passed 🚀

@madtoinou madtoinou merged commit dbed6be into master Aug 9, 2023
9 checks passed
@madtoinou madtoinou deleted the fix/ts_from_df_index_col branch August 9, 2023 16:36
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.

[BUG] converting Pandas DataFrame into TimeSeries object
3 participants