DataTypes#

daft.DataType

A Daft DataType defines the type of all the values in an Expression or DataFrame column

DataType Constructors#

Construct Daft DataTypes using these constructor APIs.

This is useful in many situations, such as casting, schema declaration and more.

import daft

dtype = daft.DataType.int64()
df = df.with_column("int64_column", df["int8_col"].cast(dtype))

Numeric#

daft.DataType.int8

Create an 8-bit integer DataType

daft.DataType.int16

Create an 16-bit integer DataType

daft.DataType.int32

Create an 32-bit integer DataType

daft.DataType.int64

Create an 64-bit integer DataType

daft.DataType.uint8

Create an unsigned 8-bit integer DataType

daft.DataType.uint16

Create an unsigned 16-bit integer DataType

daft.DataType.uint32

Create an unsigned 32-bit integer DataType

daft.DataType.uint64

Create an unsigned 64-bit integer DataType

daft.DataType.float32

Create a 32-bit float DataType

daft.DataType.float64

Create a 64-bit float DataType

Logical#

daft.DataType.bool

Create the Boolean DataType: Either True or False

Strings#

daft.DataType.binary

Create a Binary DataType: A string of bytes

daft.DataType.string

Create a String DataType: A string of UTF8 characters

Temporal#

daft.DataType.date

Create a Date DataType: A date with a year, month and day

Nested#

daft.DataType.list

Create a List DataType: Variable-length list, where each element in the list has type dtype

daft.DataType.fixed_size_list

Create a FixedSizeList DataType: Fixed-size list, where each element in the list has type dtype and each list has length size.

daft.DataType.struct

Create a Struct DataType: a nested type which has names mapped to child types

Python#

daft.DataType.python

Create a Python DataType: a type which refers to an arbitrary Python object

Complex Types#

Machine Learning#

daft.DataType.tensor

Create a tensor DataType: tensor arrays contain n-dimensional arrays of data of the provided dtype as elements, each of the provided shape.

daft.DataType.embedding

Create an Embedding DataType: embeddings are fixed size arrays, where each element in the array has a numeric dtype and each array has a fixed length of size.

Computer Vision#

daft.DataType.image

Create an Image DataType: image arrays contain (height, width, channel) ndarrays of pixel values.

ImageMode

Supported image modes for Daft's image type.

ImageFormat

Supported image formats for Daft's I/O layer.

Miscellaneous#

daft.DataType.null

Creates the Null DataType: Always the Null value