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

Broken load_preproc_data_adult #421

Open
makoeppel opened this issue Nov 28, 2022 · 6 comments · May be fixed by #484
Open

Broken load_preproc_data_adult #421

makoeppel opened this issue Nov 28, 2022 · 6 comments · May be fixed by #484
Labels
good first issue Good for newcomers

Comments

@makoeppel
Copy link

Running the following code gives me:

from aif360.algorithms.preprocessing.optim_preproc_helpers.data_preproc_functions import load_preproc_data_adult

# Get the dataset and split into train and test
dataset_orig = load_preproc_data_adult()
Traceback (most recent call last):
  File "/home/makoeppel/ranking/combined_project/notebooks/test.py", line 4, in <module>
    dataset_orig = load_preproc_data_adult()
  File "/home/makoeppel/.local/lib/python3.10/site-packages/aif360/algorithms/preprocessing/optim_preproc_helpers/data_preproc_functions.py", line 77, in load_preproc_data_adult
    return AdultDataset(
  File "/home/makoeppel/.local/lib/python3.10/site-packages/aif360/datasets/adult_dataset.py", line 107, in __init__
    super(AdultDataset, self).__init__(df=df, label_name=label_name,
  File "/home/makoeppel/.local/lib/python3.10/site-packages/aif360/datasets/standard_dataset.py", line 85, in __init__
    df = custom_preprocessing(df)
  File "/home/makoeppel/.local/lib/python3.10/site-packages/aif360/algorithms/preprocessing/optim_preproc_helpers/data_preproc_functions.py", line 13, in custom_preprocessing
    df['Age (decade)'] = df['age'].apply(lambda x: x//10*10)
  File "/home/makoeppel/.local/lib/python3.10/site-packages/pandas/core/series.py", line 4433, in apply
    return SeriesApply(self, func, convert_dtype, args, kwargs).apply()
  File "/home/makoeppel/.local/lib/python3.10/site-packages/pandas/core/apply.py", line 1088, in apply
    return self.apply_standard()
  File "/home/makoeppel/.local/lib/python3.10/site-packages/pandas/core/apply.py", line 1143, in apply_standard
    mapped = lib.map_infer(
  File "pandas/_libs/lib.pyx", line 2870, in pandas._libs.lib.map_infer
  File "/home/makoeppel/.local/lib/python3.10/site-packages/aif360/algorithms/preprocessing/optim_preproc_helpers/data_preproc_functions.py", line 13, in <lambda>
    df['Age (decade)'] = df['age'].apply(lambda x: x//10*10)
TypeError: unsupported operand type(s) for //: 'str' and 'int'

My env:

aif360==0.5.0

Downloaded the datasets from:

  1. adult.data
  2. adult.test
  3. adult.names
@mnagired mnagired added the good first issue Good for newcomers label Sep 17, 2023
@padmajaborwankar
Copy link

Hi, I would like to work on this issue.

@yehee
Copy link

yehee commented Sep 22, 2023

Hello @padmajaborwankar! Just wondering if you've been able to reproduce the issue 👀

@divyaamin9825
Copy link

Hi! I'd like to work on this issue as well(I haven't reproduced this error yet)

@divyaamin9825
Copy link

@yehee Hi I tried running this code in an attempt to reproduce this issue but my code passed with no issues.

@makoeppel
Copy link
Author

It's also a year ago when I tested it. It can of course be that it is fixed but the issue did not get closed.

@padmajaborwankar
Copy link

Hi @makoeppel, I have created a pull request containing the fix.

@yehee yehee linked a pull request Sep 22, 2023 that will close this issue
@mnagired mnagired linked a pull request Sep 27, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants