types#

2026-03-11

20 min read time

Applies to Linux

class pylibhipdf.types.DataType#

Bases: object

Indicator for the logical data type of an element in a column.

This is the Cython representation of cudf::data_type.

Parameters#

idtype_id

The type’s identifier

scaleint

The scale associated with the data. Only used for decimal data types.

static from_arrow(pa_typ) DataType#

Construct a DataType from a Python type.

Parameters#

pa_typpyarrow type

A Pyarrow type (eg. pa)

Returns#

DataType

The corresponding pylibcudf DataType.

Raises#

ImportError

If pyarrow is not installed.

TypeError

If the Python type is not supported.

static from_py(type typ: type) DataType#

Construct a DataType from a Python type.

Parameters#

typtype

A Python type (eg. int, str, list)

Returns#

DataType

The corresponding pylibcudf DataType.

Raises#

TypeError

If the Python type is not supported.

id(self) type_id#

Get the id associated with this data type.

scale(self) int32_t#

Get the scale associated with this data type.

to_arrow(self, **kwargs)#

Convert a datatype to arrow.

Returns#

pyarrow.DataType

Notes#

Translation of some types requires extra information as a keyword argument. Specifically:

  • When translating a decimal type, provide precision

  • When translating a struct type, provide fields

  • When translating a list type, provide the wrapped value_type

typestr#

DataType.typestr: str The array interface type string.

pylibhipdf.types.Interpolation#

alias of interpolation

pylibhipdf.types.MaskState#

alias of mask_state

pylibhipdf.types.NanEquality#

alias of nan_equality

pylibhipdf.types.NanPolicy#

alias of nan_policy

pylibhipdf.types.NullEquality#

alias of null_equality

pylibhipdf.types.NullOrder#

alias of null_order

pylibhipdf.types.NullAware#

alias of null_aware

pylibhipdf.types.NullPolicy#

alias of null_policy

pylibhipdf.types.Order#

alias of order

pylibhipdf.types.Sorted#

alias of sorted

pylibhipdf.types.TypeId#

alias of type_id

pylibhipdf.types.size_of(DataType t) size_t#

Returns the size in bytes of elements of the specified data_type.

Only fixed-width types are supported.

For details, see size_of().

Parameters#

tDataType

The DataType to get the size of.

Returns#

int

Size in bytes of an element of the specified type.