Skip to content

Commit 46611ca

Browse files
ragrawalragrawal
and
ragrawal
authored
added __getstate__ method (#228)
* added __getstate__ method * fixed lint issues * replaced try except with getattr Co-authored-by: ragrawal <[email protected]>
1 parent 2296362 commit 46611ca

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

sklearn_pandas/dataframe_mapper.py

+13
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,19 @@ def __setstate__(self, state):
166166
self.built_default = state.get('built_default', self.default)
167167
self.transformed_names_ = state.get('transformed_names_', [])
168168

169+
def __getstate__(self):
170+
state = super().__getstate__()
171+
state['features'] = self.features
172+
state['sparse'] = self.sparse
173+
state['default'] = self.default
174+
state['df_out'] = self.df_out
175+
state['input_df'] = self.input_df
176+
state['drop_cols'] = self.drop_cols
177+
state['build_features'] = getattr(self, 'built_features', None)
178+
state['built_default'] = self.built_default
179+
state['transformed_names_'] = self.transformed_names_
180+
return state
181+
169182
def _get_col_subset(self, X, cols, input_df=False):
170183
"""
171184
Get a subset of columns from the given table X.

0 commit comments

Comments
 (0)