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

BUG: astype(..., copy=True) doesn't copy on dask #234

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

lithomas1
Copy link
Contributor

dask.array.astype doesn't respect copy=True, so we should copy manually.

@lithomas1
Copy link
Contributor Author

oops, snuck some misc changes in.

Going to revert, sorry!

@lithomas1
Copy link
Contributor Author

cc @crusaderky @ev-br for review

return x
# dask astype doesn't respect copy=True so copy
# manually via numpy
x = np.array(x, dtype=dtype, copy=copy)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hm, thinking about this again, maybe I should do something like

x = x.astype(dtype=dtype)
if copy:
    x = x.map_blocks(lambda x: x.copy())
return x

to prevent the graph break?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant