Skip to content

Categorical and fillna issues with pandas >=1.2 #190

Merged
merged 2 commits into from
Oct 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed
- Set default value of `TSDataset.head` method ([#170](https://github.com/tinkoff-ai/etna-ts/pull/170))
- Categorical and fillna issues with pandas >=1.2 ([#190](https://github.com/tinkoff-ai/etna-ts/pull/190))

## [1.1.3] - 2021-10-08
### Fixed
Expand Down
2 changes: 1 addition & 1 deletion etna/transforms/pytorch_forecasting.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


freq_unit = self._calculate_freq_unit(self.freq)
df_flat["time_idx"] = (df_flat["timestamp"] - self.min_timestamp) / freq_unit
Expand Down