-
Notifications
You must be signed in to change notification settings - Fork 80
Fix BaseReconciliator
to work on pandas==1.1.5
#1229
Conversation
etna/datasets/tsdataset.py
Outdated
@@ -815,7 +815,7 @@ def to_hierarchical_dataset( | |||
""" | |||
df_copy = df.copy(deep=True) | |||
df_copy["segment"] = df_copy[level_columns].astype("string").agg(sep.join, axis=1) | |||
if not keep_level_columns: | |||
if not keep_level_columns and len(level_columns) > 0: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not really sure if we should do this check with len
here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In fact we don't as this method expect to exist at least one column in level_columns
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May be we can throw error in the beginning if it is empty
🚀 Deployed on https://deploy-preview-1229--etna-docs.netlify.app |
Codecov Report
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more @@ Coverage Diff @@
## master #1229 +/- ##
==========================================
+ Coverage 87.74% 87.95% +0.21%
==========================================
Files 186 186
Lines 10614 10621 +7
==========================================
+ Hits 9313 9342 +29
+ Misses 1301 1279 -22
... and 6 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
etna/datasets/tsdataset.py
Outdated
@@ -815,7 +815,7 @@ def to_hierarchical_dataset( | |||
""" | |||
df_copy = df.copy(deep=True) | |||
df_copy["segment"] = df_copy[level_columns].astype("string").agg(sep.join, axis=1) | |||
if not keep_level_columns: | |||
if not keep_level_columns and len(level_columns) > 0: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In fact we don't as this method expect to exist at least one column in level_columns
etna/datasets/tsdataset.py
Outdated
@@ -815,7 +815,7 @@ def to_hierarchical_dataset( | |||
""" | |||
df_copy = df.copy(deep=True) | |||
df_copy["segment"] = df_copy[level_columns].astype("string").agg(sep.join, axis=1) | |||
if not keep_level_columns: | |||
if not keep_level_columns and len(level_columns) > 0: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May be we can throw error in the beginning if it is empty
Before submitting (must do checklist)
Proposed Changes
Add check on length before running
DataFrame.drop
.Closing issues
Closes #1212.