Skip to content

DataType

arro3.core.DataType

bit_width

bit_width: int | None = <attribute 'bit_width' of 'arro3.core._core.DataType' objects>

list_size

list_size: int | None = <attribute 'list_size' of 'arro3.core._core.DataType' objects>

num_fields

num_fields: int = <attribute 'num_fields' of 'arro3.core._core.DataType' objects>

value_type

value_type: DataType | None = <attribute 'value_type' of 'arro3.core._core.DataType' objects>

__arrow_c_schema__ method descriptor

__arrow_c_schema__() -> object

An implementation of the Arrow PyCapsule Interface. This dunder method should not be called directly, but enables zero-copy data transfer to other Python libraries that understand Arrow memory.

For example, you can call pyarrow.field() to convert this array into a pyarrow field, without copying memory.

binary builtin

binary(length: int | None = None) -> DataType

Create variable-length or fixed size binary type.

Parameters:

  • length (int | None, default: None ) –

    If length is None then return a variable length binary type. If length is provided, then return a fixed size binary type of width length. Defaults to None.

Returns:

binary_view builtin

binary_view() -> DataType

Create a variable-length binary view type.

bool builtin

bool() -> DataType

Create instance of boolean type.

date32 builtin

date32() -> DataType

Create instance of 32-bit date (days since UNIX epoch 1970-01-01).

date64 builtin

date64() -> DataType

Create instance of 64-bit date (milliseconds since UNIX epoch 1970-01-01).

decimal128 builtin

decimal128(precision: int, scale: int) -> DataType

Create decimal type with precision and scale and 128-bit width.

Arrow decimals are fixed-point decimal numbers encoded as a scaled integer. The precision is the number of significant digits that the decimal type can represent; the scale is the number of digits after the decimal point (note the scale can be negative).

As an example, decimal128(7, 3) can exactly represent the numbers 1234.567 and -1234.567 (encoded internally as the 128-bit integers 1234567 and -1234567, respectively), but neither 12345.67 nor 123.4567.

decimal128(5, -3) can exactly represent the number 12345000 (encoded internally as the 128-bit integer 12345), but neither 123450000 nor 1234500.

If you need a precision higher than 38 significant digits, consider using decimal256.

Parameters:

  • precision (int) –

    Must be between 1 and 38 scale: description

decimal256 builtin

decimal256(precision: int, scale: int) -> DataType

Create decimal type with precision and scale and 256-bit width.

dictionary builtin

dictionary(
    index_type: ArrowSchemaExportable, value_type: ArrowSchemaExportable
) -> DataType

Dictionary (categorical, or simply encoded) type.

Parameters:

Returns:

duration builtin

duration(unit: Literal['s', 'ms', 'us', 'ns']) -> DataType

Create instance of a duration type with unit resolution.

Parameters:

  • unit (Literal['s', 'ms', 'us', 'ns']) –

    one of 's' [second], 'ms' [millisecond], 'us' [microsecond], or 'ns' [nanosecond]

Returns:

equals method descriptor

equals(other: ArrowSchemaExportable, *, check_metadata: bool = False) -> bool

Return true if type is equivalent to passed value.

Parameters:

  • other (ArrowSchemaExportable) –

    description

  • check_metadata (bool, default: False ) –

    Whether nested Field metadata equality should be checked as well. Defaults to False.

Returns:

  • bool

    description

float16 builtin

float16() -> DataType

Create half-precision floating point type.

float32 builtin

float32() -> DataType

Create single-precision floating point type.

float64 builtin

float64() -> DataType

Create double-precision floating point type.

from_arrow builtin

from_arrow(input: ArrowSchemaExportable) -> DataType

Construct this from an existing Arrow object.

It can be called on anything that exports the Arrow schema interface (__arrow_c_schema__).

from_arrow_pycapsule builtin

from_arrow_pycapsule(capsule) -> DataType

Construct this object from a bare Arrow PyCapsule

int16 builtin

int16() -> DataType

Create instance of signed int16 type.

int32 builtin

int32() -> DataType

Create instance of signed int32 type.

int64 builtin

int64() -> DataType

Create instance of signed int64 type.

int8 builtin

int8() -> DataType

Create instance of signed int8 type.

is_binary staticmethod

is_binary(t: ArrowSchemaExportable) -> bool

is_binary_view staticmethod

is_binary_view(t: ArrowSchemaExportable) -> bool

is_boolean staticmethod

is_boolean(t: ArrowSchemaExportable) -> bool

is_date staticmethod

is_date(t: ArrowSchemaExportable) -> bool

is_date32 staticmethod

is_date32(t: ArrowSchemaExportable) -> bool

is_date64 staticmethod

is_date64(t: ArrowSchemaExportable) -> bool

is_decimal staticmethod

is_decimal(t: ArrowSchemaExportable) -> bool

is_decimal128 staticmethod

is_decimal128(t: ArrowSchemaExportable) -> bool

is_decimal256 staticmethod

is_decimal256(t: ArrowSchemaExportable) -> bool

is_dictionary staticmethod

is_dictionary(t: ArrowSchemaExportable) -> bool

is_dictionary_key_type staticmethod

is_dictionary_key_type(t: ArrowSchemaExportable) -> bool

is_duration staticmethod

is_duration(t: ArrowSchemaExportable) -> bool

is_fixed_size_binary staticmethod

is_fixed_size_binary(t: ArrowSchemaExportable) -> bool

is_fixed_size_list staticmethod

is_fixed_size_list(t: ArrowSchemaExportable) -> bool

is_float16 staticmethod

is_float16(t: ArrowSchemaExportable) -> bool

is_float32 staticmethod

is_float32(t: ArrowSchemaExportable) -> bool

is_float64 staticmethod

is_float64(t: ArrowSchemaExportable) -> bool

is_floating staticmethod

is_floating(t: ArrowSchemaExportable) -> bool

is_int16 staticmethod

is_int16(t: ArrowSchemaExportable) -> bool

is_int32 staticmethod

is_int32(t: ArrowSchemaExportable) -> bool

is_int64 staticmethod

is_int64(t: ArrowSchemaExportable) -> bool

is_int8 staticmethod

is_int8(t: ArrowSchemaExportable) -> bool

is_integer staticmethod

is_integer(t: ArrowSchemaExportable) -> bool

is_interval staticmethod

is_interval(t: ArrowSchemaExportable) -> bool

is_large_binary staticmethod

is_large_binary(t: ArrowSchemaExportable) -> bool

is_large_list staticmethod

is_large_list(t: ArrowSchemaExportable) -> bool

is_large_list_view staticmethod

is_large_list_view(t: ArrowSchemaExportable) -> bool

is_large_string staticmethod

is_large_string(t: ArrowSchemaExportable) -> bool

is_large_unicode staticmethod

is_large_unicode(t: ArrowSchemaExportable) -> bool

is_list staticmethod

is_list(t: ArrowSchemaExportable) -> bool

is_list_view staticmethod

is_list_view(t: ArrowSchemaExportable) -> bool

is_map staticmethod

is_nested staticmethod

is_nested(t: ArrowSchemaExportable) -> bool

is_null staticmethod

is_null(t: ArrowSchemaExportable) -> bool

is_numeric staticmethod

is_numeric(t: ArrowSchemaExportable) -> bool

is_primitive staticmethod

is_primitive(t: ArrowSchemaExportable) -> bool

is_run_end_encoded staticmethod

is_run_end_encoded(t: ArrowSchemaExportable) -> bool

is_signed_integer staticmethod

is_signed_integer(t: ArrowSchemaExportable) -> bool

is_string staticmethod

is_string(t: ArrowSchemaExportable) -> bool

is_string_view staticmethod

is_string_view(t: ArrowSchemaExportable) -> bool

is_struct staticmethod

is_struct(t: ArrowSchemaExportable) -> bool

is_temporal staticmethod

is_temporal(t: ArrowSchemaExportable) -> bool

is_time staticmethod

is_time(t: ArrowSchemaExportable) -> bool

is_time32 staticmethod

is_time32(t: ArrowSchemaExportable) -> bool

is_time64 staticmethod

is_time64(t: ArrowSchemaExportable) -> bool

is_timestamp staticmethod

is_timestamp(t: ArrowSchemaExportable) -> bool

is_uint16 staticmethod

is_uint16(t: ArrowSchemaExportable) -> bool

is_uint32 staticmethod

is_uint32(t: ArrowSchemaExportable) -> bool

is_uint64 staticmethod

is_uint64(t: ArrowSchemaExportable) -> bool

is_uint8 staticmethod

is_uint8(t: ArrowSchemaExportable) -> bool

is_unicode staticmethod

is_unicode(t: ArrowSchemaExportable) -> bool

is_union staticmethod

is_union(t: ArrowSchemaExportable) -> bool

is_unsigned_integer staticmethod

is_unsigned_integer(t: ArrowSchemaExportable) -> bool

large_binary builtin

large_binary() -> DataType

Create large variable-length binary type.

large_list builtin

large_list(value_type: ArrowSchemaExportable) -> DataType

Create LargeListType instance from child data type or field.

This data type may not be supported by all Arrow implementations. Unless you need to represent data larger than 2**31 elements, you should prefer list().

Parameters:

Returns:

large_list_view builtin

large_list_view(value_type: ArrowSchemaExportable) -> DataType

Create LargeListViewType instance from child data type or field.

This data type may not be supported by all Arrow implementations because it is an alternative to the ListType.

Parameters:

Returns:

large_string builtin

large_string() -> DataType

Create large UTF8 variable-length string type.

large_utf8 builtin

large_utf8() -> DataType

Alias for large_string().

list builtin

list(
    value_type: ArrowSchemaExportable, list_size: int | None = None
) -> DataType

Create ListType instance from child data type or field.

Parameters:

  • value_type (ArrowSchemaExportable) –

    description

  • list_size (int | None, default: None ) –

    If length is None then return a variable length list type. If length is provided then return a fixed size list type.

Returns:

list_view builtin

list_view(value_type: ArrowSchemaExportable) -> DataType

Create ListViewType instance from child data type or field.

This data type may not be supported by all Arrow implementations because it is an alternative to the ListType.

map builtin

map(
    key_type: ArrowSchemaExportable,
    item_type: ArrowSchemaExportable,
    keys_sorted: bool,
) -> DataType

Create MapType instance from key and item data types or fields.

Parameters:

Returns:

month_day_nano_interval builtin

month_day_nano_interval() -> DataType

Create instance of an interval type representing months, days and nanoseconds between two dates.

null builtin

null() -> DataType

Create instance of null type.

run_end_encoded builtin

run_end_encoded(
    run_end_type: ArrowSchemaExportable, value_type: ArrowSchemaExportable
) -> DataType

Create RunEndEncodedType from run-end and value types.

Parameters:

Returns:

string builtin

string() -> DataType

Create UTF8 variable-length string type.

string_view builtin

string_view() -> DataType

Create UTF8 variable-length string view type.

struct builtin

Create StructType instance from fields.

A struct is a nested type parameterized by an ordered sequence of types (which can all be distinct), called its fields.

Parameters:

Returns:

time32 builtin

time32(unit: Literal['s', 'ms']) -> DataType

Create instance of 32-bit time (time of day) type with unit resolution.

Parameters:

  • unit (Literal['s', 'ms']) –

    one of 's' [second], or 'ms' [millisecond]

Returns:

time64 builtin

time64(unit: Literal['us', 'ns']) -> DataType

Create instance of 64-bit time (time of day) type with unit resolution.

Parameters:

  • unit (Literal['us', 'ns']) –

    One of 'us' [microsecond], or 'ns' [nanosecond].

Returns:

timestamp builtin

timestamp(
    unit: Literal["s", "ms", "us", "ns"], *, tz: str | None = None
) -> DataType

Create instance of timestamp type with resolution and optional time zone.

Parameters:

  • unit (Literal['s', 'ms', 'us', 'ns']) –

    one of 's' [second], 'ms' [millisecond], 'us' [microsecond], or 'ns' [nanosecond]

  • tz (str | None, default: None ) –

    Time zone name. None indicates time zone naive. Defaults to None.

Returns:

uint16 builtin

uint16() -> DataType

Create instance of unsigned int16 type.

uint32 builtin

uint32() -> DataType

Create instance of unsigned int32 type.

uint64 builtin

uint64() -> DataType

Create instance of unsigned int64 type.

uint8 builtin

uint8() -> DataType

Create instance of unsigned int8 type.

utf8 builtin

utf8() -> DataType

Alias for string().