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:
Examples
A data type permitting only
None.>>> vx.null() null()
- vortex.bool_(*, nullable=False)#
Construct a Boolean data type.
- Parameters:
- Return type:
Examples
A data type permitting
None,True, andFalse.>>> import vortex as vx >>> vx.bool_(nullable=True) bool(nullable=True)
A data type permitting just
TrueandFalse.>>> vx.bool_() bool(nullable=False)
- vortex.float_(width=64, *, nullable=False)#
Construct an IEEE 754 binary floating-point data type.
- Parameters:
- Return type:
Examples
A data type permitting
Noneas 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:
- Return type:
Examples
A data type permitting
Noneand 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:
- Return type:
Examples
A data type permitting
Noneand 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.decimal(*, precision=10, scale=0, nullable=False)#
Construct a decimal data type.
- Parameters:
- Return type:
Examples
A data type permitting
Noneand the integers from -128 to 127, inclusive:>>> import vortex as vx >>> vx.decimal(precision=13, scale=2, nullable=True) decimal(precision=13, scale=2, nullable=True)
A data type representing fixed-width decimal numbers with precision significant figures and scale digits after the decimal point. If scale is a negative value, then it is taken to be the number of trailing zeros before the decimal point.
>>> vx.decimal(precision = 10, scale = 3) decimal(precision=10, scale=3, nullable=False)
- vortex.utf8(*, nullable=False)#
Construct a UTF-8-encoded string data type.
- Parameters:
- Return type:
Examples
A data type permitting any UTF-8-encoded string, such as
"Hello World", but not permittingNone.>>> import vortex as vx >>> vx.utf8(nullable=False) utf8(nullable=False)
- vortex.binary(*, nullable=False)#
Construct a binary data type.
- Parameters:
- Return type:
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:
- Return type:
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:
- Return type:
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)
- vortex.fixed_size_list(element, size, *, nullable=False)#
Construct a fixed-size list data type.
- Parameters:
- Return type:
Examples
Create a fixed-size list of 3 integers:
>>> import vortex as vx >>> vx.fixed_size_list(vx.int_(32), 3, nullable=False) fixed_size_list(int(32, nullable=False), 3, nullable=False)
- vortex.date(unit, *, nullable=False)#
Construct a date data type.
- Parameters:
- Return type:
Examples
A data type representing dates as days since the UNIX epoch.
>>> import vortex as vx >>> vx.date("days") ext("vortex.date", int(32, nullable=False), days)
- vortex.time(unit, *, nullable=False)#
Construct a time-of-day data type.
- Parameters:
- Return type:
Examples
A data type representing time of day in microseconds.
>>> import vortex as vx >>> vx.time("us") ext("vortex.time", int(64, nullable=False), µs)
- vortex.timestamp(unit, *, tz=None, nullable=False)#
Construct a timestamp data type.
- Parameters:
- Return type:
Examples
A non-nullable timestamp in microseconds with no timezone.
>>> import vortex as vx >>> vx.timestamp("us") ext("vortex.timestamp", int(64, nullable=False), µs)
A nullable timestamp in seconds with a UTC timezone.
>>> vx.timestamp("s", tz="UTC", nullable=True) ext("vortex.timestamp", int(64, nullable=True), s, tz=UTC)
Base Class#
Do not instantiate these classes directly. Instead, call one of the factory functions above.
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.
Primitive Types#
- class vortex.PType#
Enum for primitive types.