-
Notifications
You must be signed in to change notification settings - Fork 18
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
narwhalify SetValueTransformer #398
base: main
Are you sure you want to change the base?
Conversation
df["a"] = "a" | ||
df["b"] = "a" | ||
@pytest.mark.parametrize("library", ["pandas", "polars"]) | ||
@pytest.mark.parametrize("value", ["a", 1, 1.0, None]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can see that in the transformer we allow all types and we dont have options for nans. So should we also add a missing value test here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep fair point. Was kind of expecting this to break for polars but it works still! 1251699
@@ -42,7 +48,8 @@ def __init__( | |||
|
|||
super().__init__(columns=columns, copy=copy, **kwargs) | |||
|
|||
def transform(self, X: pd.DataFrame) -> pd.DataFrame: | |||
@nw.narwhalify | |||
def transform(self, X: FrameT) -> FrameT: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update the docstring to match pd/pl.DataFrame
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am happy with the changes :)
Narwhalifying SetValueTransformer for polars compatibility.
Also extending testing to cover more values being set (was previously just testing setting a string value)
Draft because for integers we get int32 return while expected is currently int64. <- edited test to cast to int32 as transformer does.