Skip to content

Categorical and fillna issues with pandas >=1.2 #190

Merged
merged 2 commits into from
Oct 13, 2021
Merged

Conversation

martins0n
Copy link
Contributor

IMPORTANT: Please do not create a Pull Request without creating an issue first.

Before submitting (must do checklist)

  • Did you read the contribution guide?
  • Did you update the docs? We use Numpy format for all the methods and classes.
  • Did you write any new necessary tests?
  • Did you update the CHANGELOG?

Type of Change

  • Examples / docs / tutorials / contributors update
  • Bug fix (non-breaking change which fixes an issue)
  • Improvement (non-breaking change which improves an existing feature)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Proposed Changes

Fillna only target values of DataFrame.

Related Issue

#162

Closing issues

@codecov-commenter
Copy link

codecov-commenter commented Oct 13, 2021

Codecov Report

Merging #190 (75877d7) into master (04ad785) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #190   +/-   ##
=======================================
  Coverage   87.83%   87.83%           
=======================================
  Files          75       75           
  Lines        3453     3453           
=======================================
  Hits         3033     3033           
  Misses        420      420           
Impacted Files Coverage Δ
etna/transforms/pytorch_forecasting.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 04ad785...75877d7. Read the comment docs.

@@ -172,7 +172,7 @@ def transform(self, df: pd.DataFrame) -> pd.DataFrame:
ts = TSDataset(df, self.freq)
df_flat = ts.to_pandas(flatten=True)
df_flat = df_flat[df_flat.timestamp >= self.min_timestamp]
df_flat = df_flat.fillna(0)
df_flat["target"] = df_flat["target"].fillna(0)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you describe why is it necessary change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can't fill columns with categorical types with pandas >=1.2 + fillna all -- is too strong assumption, because we mostly have nan's only in the future targets

@martins0n martins0n merged commit 9a9f2c3 into master Oct 13, 2021
@martins0n martins0n deleted the issue-162-pf branch October 13, 2021 11:19
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants