# function to obtain Categorical Features def _get_categorical_features(df): feats = [col for col in list(df.columns) if df[col].dtype == 'object'] return feats # function to factorize categorical features def _factorize_categoricals(df, cats): for col in cats: df[col], _ = pd.factorize(df[col]) return df