Extension Dtypes#

cuDF supports a number of extension dtypes that build on top of the types that pandas supports. These dtypes are not directly available in pandas, which instead relies on object dtype arrays that run at Python rather than native speeds. The following dtypes are supported:

cudf.CategoricalDtype#

CategoricalDtype([categories, ordered])

Type for categorical data with the categories and orderedness.

Properties and Methods#

CategoricalDtype.categories

An Index containing the unique categories allowed.

CategoricalDtype.construct_from_string()

Construct this type from a string.

CategoricalDtype.deserialize(header, frames)

Generate an object from a serialized representation.

CategoricalDtype.device_deserialize(header, ...)

Perform device-side deserialization tasks.

CategoricalDtype.device_serialize()

Serialize data and metadata associated with device memory.

CategoricalDtype.from_pandas(dtype)

Convert a pandas.CategrocialDtype to cudf.CategoricalDtype

CategoricalDtype.host_deserialize(header, frames)

Perform device-side deserialization tasks.

CategoricalDtype.host_serialize()

Serialize data and metadata associated with host memory.

CategoricalDtype.is_dtype(dtype)

Check if we match 'dtype'.

CategoricalDtype.name

A string identifying the data type.

CategoricalDtype.ordered

Whether the categories have an ordered relationship.

CategoricalDtype.serialize()

Generate an equivalent serializable representation of an object.

CategoricalDtype.str

CategoricalDtype.to_pandas()

Convert a cudf.CategoricalDtype to pandas.CategoricalDtype

CategoricalDtype.type

The scalar type for the array, e.g.

cudf.Decimal32Dtype#

Decimal32Dtype(precision[, scale])

Type to represent a decimal32 data.

Properties and Methods#

Decimal32Dtype.ITEMSIZE

Decimal32Dtype.MAX_PRECISION

Decimal32Dtype.deserialize(header, frames)

Generate an object from a serialized representation.

Decimal32Dtype.device_deserialize(header, frames)

Perform device-side deserialization tasks.

Decimal32Dtype.device_serialize()

Serialize data and metadata associated with device memory.

Decimal32Dtype.from_arrow(typ)

Construct a cudf decimal dtype from a pyarrow dtype

Decimal32Dtype.host_deserialize(header, frames)

Perform device-side deserialization tasks.

Decimal32Dtype.host_serialize()

Serialize data and metadata associated with host memory.

Decimal32Dtype.is_dtype(dtype)

Check if we match 'dtype'.

Decimal32Dtype.itemsize

Length of one column element in bytes.

Decimal32Dtype.precision

The decimal precision, in number of decimal digits (an integer).

Decimal32Dtype.scale

The decimal scale (an integer).

Decimal32Dtype.serialize()

Generate an equivalent serializable representation of an object.

Decimal32Dtype.str

Decimal32Dtype.to_arrow()

Return the equivalent pyarrow dtype.

cudf.Decimal64Dtype#

Decimal64Dtype(precision[, scale])

Type to represent a decimal64 data.

Properties and Methods#

Decimal64Dtype.ITEMSIZE

Decimal64Dtype.MAX_PRECISION

Decimal64Dtype.deserialize(header, frames)

Generate an object from a serialized representation.

Decimal64Dtype.device_deserialize(header, frames)

Perform device-side deserialization tasks.

Decimal64Dtype.device_serialize()

Serialize data and metadata associated with device memory.

Decimal64Dtype.from_arrow(typ)

Construct a cudf decimal dtype from a pyarrow dtype

Decimal64Dtype.host_deserialize(header, frames)

Perform device-side deserialization tasks.

Decimal64Dtype.host_serialize()

Serialize data and metadata associated with host memory.

Decimal64Dtype.is_dtype(dtype)

Check if we match 'dtype'.

Decimal64Dtype.itemsize

Length of one column element in bytes.

Decimal64Dtype.precision

The decimal precision, in number of decimal digits (an integer).

Decimal64Dtype.scale

The decimal scale (an integer).

Decimal64Dtype.serialize()

Generate an equivalent serializable representation of an object.

Decimal64Dtype.str

Decimal64Dtype.to_arrow()

Return the equivalent pyarrow dtype.

cudf.Decimal128Dtype#

Decimal128Dtype(precision[, scale])

Type to represent a decimal128 data.

Properties and Methods#

Decimal128Dtype.ITEMSIZE

Decimal128Dtype.MAX_PRECISION

Decimal128Dtype.deserialize(header, frames)

Generate an object from a serialized representation.

Decimal128Dtype.device_deserialize(header, ...)

Perform device-side deserialization tasks.

Decimal128Dtype.device_serialize()

Serialize data and metadata associated with device memory.

Decimal128Dtype.from_arrow(typ)

Construct a cudf decimal dtype from a pyarrow dtype

Decimal128Dtype.host_deserialize(header, frames)

Perform device-side deserialization tasks.

Decimal128Dtype.host_serialize()

Serialize data and metadata associated with host memory.

Decimal128Dtype.is_dtype(dtype)

Check if we match 'dtype'.

Decimal128Dtype.itemsize

Length of one column element in bytes.

Decimal128Dtype.precision

The decimal precision, in number of decimal digits (an integer).

Decimal128Dtype.scale

The decimal scale (an integer).

Decimal128Dtype.serialize()

Generate an equivalent serializable representation of an object.

Decimal128Dtype.str

Decimal128Dtype.to_arrow()

Return the equivalent pyarrow dtype.

cudf.ListDtype#

ListDtype(element_type)

Type to represent list data.

Properties and Methods#

ListDtype.deserialize(header, frames)

Generate an object from a serialized representation.

ListDtype.device_deserialize(header, frames)

Perform device-side deserialization tasks.

ListDtype.device_serialize()

Serialize data and metadata associated with device memory.

ListDtype.element_type

Returns the element type of the ListDtype.

ListDtype.from_arrow(typ)

Creates a ListDtype from pyarrow.ListType.

ListDtype.host_deserialize(header, frames)

Perform device-side deserialization tasks.

ListDtype.host_serialize()

Serialize data and metadata associated with host memory.

ListDtype.is_dtype(dtype)

Check if we match 'dtype'.

ListDtype.leaf_type

Returns the type of the leaf values.

ListDtype.serialize()

Generate an equivalent serializable representation of an object.

ListDtype.to_arrow()

Convert to a pyarrow.ListType

ListDtype.type

The scalar type for the array, e.g.

cudf.StructDtype#

StructDtype(fields)

Type to represent a struct data.

Properties and Methods#

StructDtype.deserialize(header, frames)

Generate an object from a serialized representation.

StructDtype.device_deserialize(header, frames)

Perform device-side deserialization tasks.

StructDtype.device_serialize()

Serialize data and metadata associated with device memory.

StructDtype.fields

Returns an ordered dict of column name and dtype key-value.

StructDtype.from_arrow(typ)

Convert a pyarrow.StructType to StructDtype.

StructDtype.host_deserialize(header, frames)

Perform device-side deserialization tasks.

StructDtype.host_serialize()

Serialize data and metadata associated with host memory.

StructDtype.is_dtype(dtype)

Check if we match 'dtype'.

StructDtype.serialize()

Generate an equivalent serializable representation of an object.

StructDtype.to_arrow()

Convert a StructDtype to a pyarrow.StructType.

StructDtype.type

The scalar type for the array, e.g.