Skip to content

Commit 4fac09e

Browse files
committed
added option to disable progress bar
1 parent 1a8ea06 commit 4fac09e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

sklearn_pandas/dataframe_mapper.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class DataFrameMapper(BaseEstimator, TransformerMixin):
7070
"""
7171

7272
def __init__(self, features, default=False, sparse=False, df_out=False,
73-
input_df=False):
73+
input_df=False, show_progress=False):
7474
"""
7575
Params:
7676
@@ -111,6 +111,7 @@ def __init__(self, features, default=False, sparse=False, df_out=False,
111111
self.df_out = df_out
112112
self.input_df = input_df
113113
self.transformed_names_ = []
114+
self.show_progress = show_progress
114115

115116
if (df_out and (sparse or default)):
116117
raise ValueError("Can not use df_out with sparse or default")
@@ -210,7 +211,7 @@ def fit(self, X, y=None):
210211
211212
"""
212213
self._build()
213-
pbar = tqdm(self.built_features)
214+
pbar = tqdm(self.built_features, disable=not self.show_progress)
214215
for columns, transformers, options in pbar:
215216
pbar.set_description("[Fit] %s" % columns)
216217
input_df = options.get('input_df', self.input_df)
@@ -292,7 +293,7 @@ def _transform(self, X, y=None, do_fit=False):
292293

293294
extracted = []
294295
self.transformed_names_ = []
295-
pbar = tqdm(self.built_features)
296+
pbar = tqdm(self.built_features, disable=not self.show_progress)
296297
for columns, transformers, options in pbar:
297298
pbar.set_description("[Transform] %s" % columns)
298299
input_df = options.get('input_df', self.input_df)

0 commit comments

Comments
 (0)