MCPcopy Create free account
hub / github.com/apache/arrow / get_buffers

Method get_buffers

python/pyarrow/interchange/column.py:428–465  ·  view source on GitHub ↗

Return a dictionary containing the underlying buffers. The returned dictionary has the following contents: - "data": a two-element tuple whose first element is a buffer containing the data and whose second element is the data

(self)

Source from the content-addressed store, hash-verified

426 yield self
427
428 def get_buffers(self) -> ColumnBuffers:
429 """
430 Return a dictionary containing the underlying buffers.
431
432 The returned dictionary has the following contents:
433
434 - "data": a two-element tuple whose first element is a buffer
435 containing the data and whose second element is the data
436 buffer's associated dtype.
437 - "validity": a two-element tuple whose first element is a buffer
438 containing mask values indicating missing data and
439 whose second element is the mask value buffer's
440 associated dtype. None if the null representation is
441 not a bit or byte mask.
442 - "offsets": a two-element tuple whose first element is a buffer
443 containing the offset values for variable-size binary
444 data (e.g., variable-length strings) and whose second
445 element is the offsets buffer's associated dtype. None
446 if the data buffer does not have an associated offsets
447 buffer.
448 """
449 buffers: ColumnBuffers = {
450 "data": self._get_data_buffer(),
451 "validity": None,
452 "offsets": None,
453 }
454
455 try:
456 buffers["validity"] = self._get_validity_buffer()
457 except NoBufferPresent:
458 pass
459
460 try:
461 buffers["offsets"] = self._get_offsets_buffer()
462 except NoBufferPresent:
463 pass
464
465 return buffers
466
467 def _get_data_buffer(
468 self,

Callers 5

test_bufferFunction · 0.80
column_to_arrayFunction · 0.80
bool_column_to_arrayFunction · 0.80

Calls 3

_get_data_bufferMethod · 0.95
_get_validity_bufferMethod · 0.95
_get_offsets_bufferMethod · 0.95

Tested by 2

test_bufferFunction · 0.64