cudf.core.dtypes.StructDtype#

class cudf.core.dtypes.StructDtype(fields)#

Type to represent a struct data.

Parameters:
fieldsdict

A mapping of field names to dtypes, the dtypes can themselves be of StructDtype too.

Examples

>>> import cudf
>>> struct_dtype = cudf.StructDtype({"a": "int64", "b": "string"})
>>> struct_dtype
StructDtype({'a': dtype('int64'), 'b': dtype('O')})

A nested StructDtype can also be constructed in the following way:

>>> nested_struct_dtype = cudf.StructDtype({"dict_data": struct_dtype, "c": "uint8"})
>>> nested_struct_dtype
StructDtype({'dict_data': StructDtype({'a': dtype('int64'), 'b': dtype('O')}), 'c': dtype('uint8')})

Attributes

fields

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

itemsize

Methods

from_arrow(typ)

Convert a pyarrow.StructType to StructDtype.

to_arrow()

Convert a StructDtype to a pyarrow.StructType.