clean_col_name

clean_col_name(df)

Rename columns for consistency and readability and return the new dataframe.

  • Replace ‘.’ with ’_’
  • Rename ‘fnlwgt’ to a more meaningful name

Parameters

Name Type Description Default
df pd.DataFrame Dataframe including the Adult Census Income dataset. required

Returns

Name Type Description
df pd.DataFrame The dataframe with new, meaningful column names.

Raises

Name Type Description
TypeError If df is not a pandas DataFrame.
ValueError If fnlwgt is not a column of df.

Examples

>>> clean_col_name(adult_census_df)