-
Notifications
You must be signed in to change notification settings - Fork 21
Add allow_copy
flag to interchange protocol
#51
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
Conversation
This PR adds a flag to throw an exception if the export cannot be zero-copy. (e.g. for pandas, possible due to block manager where rows are contiguous and columns are not) . - Add `allow_zero_copy` flag to the DataFrame class. - Propagate the flag to the buffer and raise a `RuntimeError` when it is true - Fix `test_noncontiguous_columns` - Make update in the requirements doc
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.
LGTM. Nothing obvious jumps out at me. One minor clarification question left in the review regarding when we're choosing to pass allow_copy
.
dtype = self.dtype | ||
elif self.dtype[0] == _k.CATEGORICAL: | ||
codes = self._col.values.codes | ||
buffer = _PandasBuffer(codes) | ||
buffer = _PandasBuffer( |
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.
As a sanity check, we're not similarly passing allow_copy
at L595, L634, and L676 because we have guaranteed contiguous buffers in those cases?
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.
Yes indeed. np.asarray(some_list)
creates a new contiguous array, and the bytearray
usage seems to be contiguous too (that one was a bit harder to verify, but I did test it).
Okay, in it goes then. Thanks for verifying @kgryte |
Rebase and fix up of gh-44.