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

add apply_to method for base transforms #220

Merged
merged 2 commits into from
Dec 15, 2021
Merged

Conversation

eli-pinkus
Copy link
Collaborator

@eli-pinkus eli-pinkus commented Dec 10, 2021

Allows user to use logic imbedded in a transform in an ad-hoc context via the following syntax:

df_transformed = MyWackyTransform.apply_to(df, param1='arg_for_param1', param2='arg_for_param2')

Comment on lines 81 to 85
trans = cls()
for key, value in kwargs.items():
setattr(trans, key, value)

return trans.apply(table)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't work?

Suggested change
trans = cls()
for key, value in kwargs.items():
setattr(trans, key, value)
return trans.apply(table)
return cls(**kwargs).apply(table)

Copy link
Collaborator Author

@eli-pinkus eli-pinkus Dec 10, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yea that's definitely cleaner, though, we currently use what's there for our BXDSTransform class and it works fine.

@philippjfr philippjfr merged commit 16632f2 into master Dec 15, 2021
@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants