-
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
Feature/nw datediffleapyeartransformer #394
base: main
Are you sure you want to change the base?
Conversation
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.
thanks for this @ChristinaKatsiafa. Think there is still a bit to do, as I think you need to also narwhalify calculate_age so we can remove the pandas specific logic in transform.
tubular/dates.py
Outdated
|
||
X[self.new_column_name] = X.apply(self.calculate_age, axis=1) | ||
X = X.to_native() |
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.
Q: not sure I get why we are doing this last step, what dtype is coming out of the above operation? Understand we were getting issues with the dtype in the expected dataframes for tests when nulls present but did not realise we were also casting 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.
This is because narwhals returns the results as int64[pyarrow] instead of Int64. So I just force the change.
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'm not sure returning int64[pyarrow] is a problem so would be inclined to leave it and update the test rather than here. What do you think?
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.
The change is ready to review :)
This is a pull request to convert datediffleapyeartransformer to narwhals.