-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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 dask.dataframe.series.view() #8533
Conversation
Can one of the admins verify this patch? |
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 @pavithraes, this is looking good!
def test_view(): | ||
s = pd.Series(range(10), dtype="int8") | ||
ds = dd.from_pandas(s, npartitions=2) | ||
assert_eq(ds.view("uint8"), s.view("uint8")) |
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.
It think it's also worth adding a test for the original issue in #8439 (that is to say, that we can view
a datetime without issue)
dask/dataframe/core.py
Outdated
@@ -3839,6 +3839,10 @@ def is_monotonic_decreasing(self): | |||
token="monotonic_decreasing", | |||
) | |||
|
|||
@derived_from(pd.Series) | |||
def view(self, dtype): | |||
return self.map_partitions(M.view, dtype, enforce_metadata=False) |
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.
You may need to also update the _meta
object for consistency
@ian-r-rose Thanks for reviewing! I've addressed your comments. :) |
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 @pavithraes, this looks good to me!
add to allowlist |
This is in! Thanks @pavithraes :) |
pre-commit run --all-files