dask / dask/dask-ml

Datetime index errors in DummyEncoder and OrdinalEncoder

Open
#362 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
951
Forks
262
PR merge metrics
No merged PRs in 30d

Description

I've noticed that inverse_transform() is trying to iterate through the dataset by index and thus raises:

`ValueError: Cannot add integral value to Timestamp without freq.`

A small example below for the DummyEncoder, although the same thing happens with the OrdinalEncoder:

The dask dataframe:

![issue_dummy_df](https://user-images.githubusercontent.com/25220090/45362190-1714e000-b5cc-11e8-9156-2d10a4a10f15.png)

Then I pass the intended feature column to the Categorizer:
```
cat = Categorizer(columns=['float_feature'])
df_categorized = cat.fit_transform(df)
```
At this point I setup the transformer and transform the dataframe's selected columns:
```
dummy_encoder = DummyEncoder(columns=['float_feature'])
dummy_encoder2 = dummy_encoder.fit(df_categorized)
dummy_encoded = dummy_encoder2.transform(df_categorized)
```
![df_transformed](https://user-images.githubusercontent.com/25220090/45362940-154c1c00-b5ce-11e8-834c-af5b607d6a58.png)

Finally the inverse_transform:

![inverse_error](https://user-images.githubusercontent.com/25220090/45362628-3eb87800-b5cd-11e8-804a-b86d34d8a3bb.png)

Why is the index relevant to these encoders' inverse transforms? Is this the intended behaviour?

Update: For clarity and minor orthography issues.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.