pyarrow.ResizableBuffer

class pyarrow.ResizableBuffer

Bases: pyarrow.lib.Buffer

A base class for buffers that can be resized.

__init__()

Initialize self. See help(type(self)) for accurate signature.

Methods

equals(self, Buffer other) Determine if two buffers contain exactly the same data.
resize(self, int64_t new_size[, shrink_to_fit]) Resize buffer to indicated size.
slice(self[, offset, length]) Slice this buffer.
to_pybytes(self) Return this buffer as a Python bytes object.

Attributes

address The buffer’s address, as an integer.
is_mutable Whether the buffer is mutable.
parent
size The buffer size in bytes.
address

The buffer’s address, as an integer.

equals(self, Buffer other)

Determine if two buffers contain exactly the same data.

Parameters:other (Buffer) –
Returns:are_equal (True if buffer contents and size are equal)
is_mutable

Whether the buffer is mutable.

parent
resize(self, int64_t new_size, shrink_to_fit=False)

Resize buffer to indicated size.

Parameters:
  • new_size (int) – New size of buffer (padding may be added internally)
  • shrink_to_fit (boolean, default False) – If this is true, the buffer is shrunk when new_size is less than the current size. If this is false, the buffer is never shrunk.
size

The buffer size in bytes.

slice(self, offset=0, length=None)

Slice this buffer. Memory is not copied.

You can also use the Python slice notation buffer[start:stop].

Parameters:
  • offset (int, default 0) – Offset from start of buffer to slice
  • length (int, default None) – Length of slice (default is until end of Buffer starting from offset)
Returns:

sliced (Buffer) – A logical view over this buffer.

to_pybytes(self)

Return this buffer as a Python bytes object. Memory is copied.