peal.data.tabular_datasets.curate_adult_frame

peal.data.tabular_datasets.curate_adult_frame(df)[source]

Turn a raw Adult table into the one-hot encoding the configs select.

Reproduces tools/curate_data_adult.py step for step, so the columns and the scaling match the ones behind the published number: keep eight features plus the target, binarise the target at >50K, merge the sparse workclass, occupation and marital-status categories, one-hot encode with drop_first, and scale the numeric columns to [-1, 1].

Accepts either spelling of the two columns the UCI and Kaggle versions disagree on (education-num/educational-num, sex/gender).

Parameters:

df (pandas.DataFrame) – Raw Adult table with the original category strings.

Returns:

Curated table: one-hot feature columns plus Target.

Return type:

pandas.DataFrame