Skip to content

Broken load_preproc_data_adult #421

Open
@makoeppel

Description

@makoeppel

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions