Skip to content
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

SubsetTransformer is missing alias after deepcopy #90

Closed
micahjsmith opened this issue Jul 17, 2021 · 1 comment
Closed

SubsetTransformer is missing alias after deepcopy #90

micahjsmith opened this issue Jul 17, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@micahjsmith
Copy link
Contributor

  • ballet version: 0.19.3

Description

Mysteriously, the subset transformer is missing the attribute alias after a deepcopy operation

What I Did

from ballet.eng import SubsetTransformer, IdentityTransformer
from copy import deepcopy
t = SubsetTransformer('a', IdentityTransformer())
t.alias  # okay
deepcopy(t).alias  # error
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-42-82dcfda2edba> in <module>
----> 1 deepcopy(t).alias

AttributeError: 'SubsetTransformer' object has no attribute 'alias'
@micahjsmith micahjsmith added the bug Something isn't working label Jul 17, 2021
@micahjsmith
Copy link
Contributor Author

On sklearn-pandas 1.x, __setstate__ (but not __getstate__!) is implemented to provide compatibility with older versions of itself. This implementation does not call super so classes that inherit from DataFrameMapper (as SubsetTransformer does) lose their new attributes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant