Skip to content

added __getstate__ method #228

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jan 6, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions sklearn_pandas/dataframe_mapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,19 @@ def __setstate__(self, state):
self.built_default = state.get('built_default', self.default)
self.transformed_names_ = state.get('transformed_names_', [])

def __getstate__(self):
state = super().__getstate__()
state['features'] = self.features
state['sparse'] = self.sparse
state['default'] = self.default
state['df_out'] = self.df_out
state['input_df'] = self.input_df
state['drop_cols'] = self.drop_cols
state['build_features'] = getattr(self, 'built_features', None)
state['built_default'] = self.built_default
state['transformed_names_'] = self.transformed_names_
return state

def _get_col_subset(self, X, cols, input_df=False):
"""
Get a subset of columns from the given table X.
Expand Down