set_dtype

set_dtype(df)

Update the data types for each columns to increase efficiency.

Sets the follow dtypes: age int8 workclass category fnlwgt int32 education category education.num int8 marital.status category occupation category relationship category race category sex category capital.gain int32 capital.loss int32 hours.per.week int8 native.country category income category

Parameters

Name Type Description Default
df pd.Dataframe The adult census income dataset found here: https://www.kaggle.com/datasets/uciml/adult-census-income required

Returns

Name Type Description
pd.Dataframe The adult census imcome dataframe with updated data types.

Raises

Name Type Description
TypeError If df is not a pandas DataFrame.
ValueError If columns do not match the columns of the adult census income dataset from kaggle. See Parameters.

Examples

>>> set_dtype(adult_census_df)