def basen_encode(self, X_in, cols=None):
X = X_in.copy(deep=True)<EOL>cols = X.columns.values.tolist()<EOL>for switch in self.mapping:<EOL><INDENT>col = switch.get('<STR_LIT>')<EOL>mod = switch.get('<STR_LIT>')<EOL>base_df = mod.reindex(X[col])<EOL>base_df.set_index(X.index, inplace=True)<EOL>X = pd.concat([base_df, X], axis=<NUM_LIT:1>)<EOL>old_column_index = cols.index(col)<EOL>cols[old_column_index: old_column_index + <NUM_LIT:1>] = mod.columns<EOL><DEDENT>return X.reindex(columns=cols)<EOL>
Basen encoding encodes the integers as basen code with one column per digit.

Parameters
----------
X_in: DataFrame
cols: list-like, default None
    Column names in the DataFrame to be encoded

Returns
-------
dummies : DataFrame