Data Types

The logical types of the elements of an Array. Each logical type is implemented by a variety of Array encodings which describe both a representation-as-bytes as well as how to apply operations on that representation.

Factory Functions

vortex.null()

Construct the data type for a column containing only the null value.

Return type:

vortex.DType

Examples

A data type permitting only None.

>>> import vortex as vx
>>> vx.null()
null()
vortex.bool_(*, nullable=False)

Construct a Boolean data type.

Parameters:

nullable (bool) – When True, None is a permissible value.

Return type:

vortex.DType

Examples

A data type permitting None, True, and False.

>>> import vortex as vx
>>> vx.bool_(nullable=True)
bool(nullable=True)

A data type permitting just True and False.

>>> vx.bool_()
bool(nullable=False)
vortex.float_(width=64, *, nullable=False)

Construct an IEEE 754 binary floating-point data type.

Parameters:
  • width (Literal[16, 32, 64].) – The bit width determines the range and precision of the floating-point values. If None, 64 is used.

  • nullable (bool) – When True, None is a permissible value.

Return type:

vortex.DType

Examples

A data type permitting None as well as IEEE 754 binary16 floating-point values. Values larger than 65,520 or less than -65,520 will respectively round to positive and negative infinity.

>>> import vortex as vx
>>> vx.float_(16, nullable=False)
float(16, nullable=False)
vortex.int_(width=64, *, nullable=False)

Construct a signed integral data type.

Parameters:
  • width (Literal[8, 16, 32, 64].) – The bit width determines the span of valid values. If None, 64 is used.

  • nullable (bool) – When True, None is a permissible value.

Return type:

vortex.DType

Examples

A data type permitting None and the integers from -128 to 127, inclusive:

>>> import vortex as vx
>>> vx.int_(8, nullable=True)
int(8, nullable=True)

A data type permitting just the integers from -2,147,483,648 to 2,147,483,647, inclusive:

>>> vx.int_(32)
int(32, nullable=False)
vortex.uint(width=64, *, nullable=False)

Construct an unsigned integral data type.

Parameters:
  • width (Literal[8, 16, 32, 64].) – The bit width determines the span of valid values. If None, 64 is used.

  • nullable (bool) – When True, None is a permissible value.

Return type:

vortex.DType

Examples

A data type permitting None and the integers from 0 to 255, inclusive:

>>> import vortex as vx
>>> vx.uint(8, nullable=True)
uint(8, nullable=True)

A data type permitting just the integers from 0 to 4,294,967,296 inclusive:

>>> vx.uint(32, nullable=False)
uint(32, nullable=False)
vortex.utf8(*, nullable=False)

Construct a UTF-8-encoded string data type.

Parameters:

nullable (bool) – When True, None is a permissible value.

Return type:

vortex.DType

Examples

A data type permitting any UTF-8-encoded string, such as "Hello World", but not permitting None.

>>> import vortex as vx
>>> vx.utf8(nullable=False)
utf8(nullable=False)
vortex.binary(*, nullable=False)

Construct a binary data type.

Parameters:

nullable (bool) – When True, None is a permissible value.

Return type:

vortex.DType

Examples

A data type permitting any string of bytes but not permitting None.

>>> import vortex as vx
>>> vx.binary(nullable=False)
binary(nullable=False)
vortex.struct(fields=None, *, nullable=False)

Construct a struct data type.

Parameters:
  • fields (dict) – A mapping from field names to data types.

  • nullable (bool) – When True, None is a permissible value.

Return type:

vortex.DType

Examples

A data type permitting a struct with two fields, "name" and "age", where "name" is a UTF-8-encoded string and "age" is a 32-bit signed integer:

>>> import vortex as vx
>>> vx.struct({"name": vx.utf8(), "age": vx.int_(32)})
struct({"name": utf8(nullable=False), "age": int(32, nullable=False)}, nullable=False)
vortex.list_(element, *, nullable=False)

Construct a list data type.

Parameters:
  • element (DType) – The type of the list element.

  • nullable (bool) – When True, None is a permissible value (this is not element nullability).

Return type:

vortex.DType

Examples

A data type permitting a list of 32-bit signed integers, but not permitting None.

>>> import vortex as vx
>>> vx.list_(vx.int_(32), nullable=False)
list(int(32, nullable=False), nullable=False)

Base Class

Do not instantiate these classes directly. Instead, call one of the factory functions above.

class vortex.DType

Base class for all Vortex data types.

from_arrow(*, non_nullable=False)

Construct a Vortex data type from an Arrow data type.

DType Classes

class vortex.NullDType

Concrete class for null dtypes.

class vortex.BoolDType

Concrete class for boolean dtypes.

class vortex.PrimitiveDType

Concrete class for primitive dtypes.

class vortex.Utf8DType

Concrete class for utf8 dtypes.

class vortex.BinaryDType

Concrete class for utf8 dtypes.

class vortex.StructDType

Concrete class for struct dtypes.

fields()

Returns the field DTypes of the struct.

names()

Returns the names of the struct fields.

class vortex.ListDType

Concrete class for list dtypes.

class vortex.ExtensionDType

Concrete class for extension dtypes.