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

Method _get_data_buffer

python/pyarrow/interchange/column.py:467–488  ·  view source on GitHub ↗

Return the buffer containing the data and the buffer's associated dtype.

(
        self,
    )

Source from the content-addressed store, hash-verified

465 return buffers
466
467 def _get_data_buffer(
468 self,
469 ) -> Tuple[_PyArrowBuffer, Any]: # Any is for self.dtype tuple
470 """
471 Return the buffer containing the data and the buffer's
472 associated dtype.
473 """
474 array = self._col
475 dtype = self.dtype
476
477 # In case of dictionary arrays, use indices
478 # to define a buffer, codes are transferred through
479 # describe_categorical()
480 if pa.types.is_dictionary(array.type):
481 array = array.indices
482 dtype = _PyArrowColumn(array).dtype
483
484 n = len(array.buffers())
485 if n == 2:
486 return _PyArrowBuffer(array.buffers()[1]), dtype
487 elif n == 3:
488 return _PyArrowBuffer(array.buffers()[2]), dtype
489
490 def _get_validity_buffer(self) -> Tuple[_PyArrowBuffer, Any]:
491 """

Callers 1

get_buffersMethod · 0.95

Calls 4

_PyArrowBufferClass · 0.90
_PyArrowColumnClass · 0.85
lenFunction · 0.85
buffersMethod · 0.80

Tested by

no test coverage detected