pyarrow.compute.CastOptions

class pyarrow.compute.CastOptions(target_type=None, *, allow_int_overflow=None, allow_time_truncate=None, allow_time_overflow=None, allow_decimal_truncate=None, allow_float_truncate=None, allow_invalid_utf8=None)

Bases: _CastOptions

Options for the cast function.

Parameters:
target_typeDataType, optional

The PyArrow type to cast to.

allow_int_overflowbool, default False

Whether integer overflow is allowed when casting.

allow_time_truncatebool, default False

Whether time precision truncation is allowed when casting.

allow_time_overflowbool, default False

Whether date/time range overflow is allowed when casting.

allow_decimal_truncatebool, default False

Whether decimal precision truncation is allowed when casting.

allow_float_truncatebool, default False

Whether floating-point precision truncation is allowed when casting.

allow_invalid_utf8bool, default False

Whether producing invalid utf8 data is allowed when casting.

__init__(self, target_type=None, *, allow_int_overflow=None, allow_time_truncate=None, allow_time_overflow=None, allow_decimal_truncate=None, allow_float_truncate=None, allow_invalid_utf8=None)

Methods

__init__(self[, target_type, ...])

deserialize(buf)

Deserialize options for a function.

is_safe(self)

safe([target_type])

"

serialize(self)

unsafe([target_type])

"

Attributes

allow_decimal_truncate

allow_float_truncate

allow_int_overflow

allow_invalid_utf8

allow_time_overflow

allow_time_truncate

allow_decimal_truncate
allow_float_truncate
allow_int_overflow
allow_invalid_utf8
allow_time_overflow
allow_time_truncate
static deserialize(buf)

Deserialize options for a function.

Parameters:
bufBuffer

The buffer containing the data to deserialize.

is_safe(self)
static safe(target_type=None)

” Create a CastOptions for a safe cast.

Parameters:
target_typeoptional

Target cast type for the safe cast.

serialize(self)
static unsafe(target_type=None)

” Create a CastOptions for an unsafe cast.

Parameters:
target_typeoptional

Target cast type for the unsafe cast.