pyarrow.ResizableBuffer#

classpyarrow.ResizableBuffer#

Bases:Buffer

A base class for buffers that can be resized.

__init__(*args,**kwargs)#

Methods

__init__(*args, **kwargs)

equals(self, Buffer other)

Determine if two buffers contain exactly the same data.

hex(self)

Compute hexadecimal representation of the buffer.

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.

device

The device where the buffer resides.

device_type

The device type where the buffer resides.

is_cpu

Whether the buffer is CPU-accessible.

is_mutable

Whether the buffer is mutable.

memory_manager

The memory manager associated with the buffer.

parent

size

The buffer size in bytes.

address#

The buffer’s address, as an integer.

The returned address may point to CPU or device memory.Useis_cpu() to disambiguate.

device#

The device where the buffer resides.

Returns:
Device
device_type#

The device type where the buffer resides.

Returns:
DeviceAllocationType
equals(self,Bufferother)#

Determine if two buffers contain exactly the same data.

Parameters:
otherBuffer
Returns:
are_equalbool

True if buffer contents and size are equal

hex(self)#

Compute hexadecimal representation of the buffer.

Returns:
:bytes
is_cpu#

Whether the buffer is CPU-accessible.

is_mutable#

Whether the buffer is mutable.

memory_manager#

The memory manager associated with the buffer.

Returns:
MemoryManager
parent#
resize(self,int64_tnew_size,shrink_to_fit=False)#

Resize buffer to indicated size.

Parameters:
new_sizeint

New size of buffer (padding may be added internally).

shrink_to_fitbool, defaultFalse

If this is true, the buffer is shrunk when new_size is lessthan 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 notationbuffer[start:stop].

Parameters:
offsetint, default 0

Offset from start of buffer to slice.

lengthint, defaultNone

Length of slice (default is until end of Buffer starting fromoffset).

Returns:
slicedBuffer

A logical view over this buffer.

to_pybytes(self)#

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