Uh oh!
There was an error while loading. Please reload this page.
Add allow_copy flag to interchange protocol - #51
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
kgryte
left a comment
There was a problem hiding this comment.
LGTM. Nothing obvious jumps out at me. One minor clarification question left in the review regarding when we're choosing to pass allow_copy.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| elif self.dtype[0] == _k.CATEGORICAL: | ||
| codes = self._col.values.codes | ||
| buffer = _PandasBuffer(codes) | ||
| buffer = _PandasBuffer( |
There was a problem hiding this comment.
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.
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).
rgommers
commented
Aug 24, 2021
Okay, in it goes then. Thanks for verifying @kgryte |
Rebase and fix up of gh-44.