def _op(self, df, verbose):
inter_df = df
colnames = list(self._bin_map.keys())
if verbose:
colnames = tqdm.tqdm(colnames)
for colname in colnames:
if verbose:
colnames.set_description(colname)
source_col = df[colname]
loc = df.columns.get_loc(colname) + 1
new_name = colname + "_bin"
if self._drop:
inter_df = inter_df.drop(colname, axis=1)
new_name = colname
loc -= 1
inter_df = out_of_place_col_insert(
df=inter_df,
series=source_col.apply(
self._get_col_binner(self._bin_map[colname])),
loc=loc,
column_name=new_name)
return inter_df
评论列表
文章目录