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

UInt8 conversion error with HyperTransform #518

Open
Metalkiler opened this issue May 26, 2022 · 0 comments
Open

UInt8 conversion error with HyperTransform #518

Metalkiler opened this issue May 26, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@Metalkiler
Copy link

Environment Details

Please indicate the following details about the environment in which you found the bug:

  • RDT version: 1.0
  • Python version: 3.8
  • Operating System: Ubuntu

Error Description

I was trying to convert a pandas dataframe using the hypertransformer obtained from the openml website, however this process gave this error
File "/home/luismatos/.conda/envs/luismatos/lib/python3.8/site-packages/rdt/hyper_transformer.py", line 600, in detect_initial_config
self._learn_config(data)
File "/home/luismatos/.conda/envs/luismatos/lib/python3.8/site-packages/rdt/hyper_transformer.py", line 574, in _learn_config
self._set_field_sdtype(data, field)
File "/home/luismatos/.conda/envs/luismatos/lib/python3.8/site-packages/rdt/hyper_transformer.py", line 559, in _set_field_sdtype
self.field_sdtypes[field] = self._DTYPES_TO_SDTYPES[kind]
KeyError: 'u'

however i was expecting something like the example provided in the github page

Steps to reproduce


import openml
import ast
#sys argument is used write the id of a dataset in the openml website and the target column 

print("Running code with dataset:", sys.argv[1])
print("Target column", sys.argv[2])
data = openml.datasets.get_dataset(sys.argv[1])

df = data.get_data()[0] 

print(irisdf.info())

ht = HyperTransformer()

ht.detect_initial_config(df)

ht.fit(df)

df = ht.transform(df)

However using the following process:

tipos = irisdf.convert_dtypes().dtypes
listaTipos = [str(i) for i in tipos]
for i in trange(0, len(listaTipos)):
  if listaTipos[i] == "UInt8":
    cols = tipos.keys()[i]
    df[cols] = df[cols].astype(str).astype(int)

it solves the issue! It only happens with the UInt8 (so far as I know).

Thanks for the attention :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants