-
Notifications
You must be signed in to change notification settings - Fork 414
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
Unexpected Dropping of columns #257
Comments
I have modified the Previous build function: def _build(self, X=None):
"""
Build attributes built_features and built_default.
"""
if isinstance(self.features, list):
self.built_features = [
_build_feature(*f, X=X) for f in self.features
]
else:
self.built_features = _build_feature(*self.features, X=X)
self.built_default = _build_transformer(self.default) Modified code: def _build(self, X=None):
"""
Build attributes built_features and built_default.
"""
if isinstance(self.features, list):
filtered_list = []
for obj in self.features:
if isinstance(obj[0], list):
new_cols = [col for col in obj[0] if col not in self.drop_cols]
new_tuple = tuple([new_cols] + list(obj[1:]))
filtered_list.append(new_tuple)
else:
if obj[0] not in self.drop_cols:
filtered_list.append(obj)
self.features = filtered_list
self.built_features = [_build_feature(*f, X=X) for f in self.features]
else:
self.built_features = _build_feature(*self.features, X=X)
self.built_default = _build_transformer(self.default) Any feedback or suggestions on my code changes would be greatly appreciated. Thank you! |
你好,已收到,谢谢。
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In the following lines the resulting prints do not change if the line
drop_cols=["salary"]
is commented out:In both the uncommented and the commented case there is no salary column in the transformed dataframe. I would have expected that unmentioned columns are not touched, especially since the drop_cols option exists.
Is this just me having arbitrary expectations or is there something strange going on?
The text was updated successfully, but these errors were encountered: