fields.buffers.base.BufferBase.astype#

BufferBase.astype(dtype: Any, *args, **kwargs) BufferBase[source]#

Return a copy of this buffer with a different data type.

This performs a type conversion using the underlying array and returns a new buffer of the same class with the updated dtype.

Parameters:
  • dtype (data-type) – The target data type for the returned array.

  • *args – Additional positional arguments forwarded to from_array.

  • **kwargs – Additional keyword arguments forwarded to astype() and from_array.

Returns:

A new buffer instance with the specified data type.

Return type:

BufferBase