cudf.core.dtypes.StructDtype#
- class cudf.core.dtypes.StructDtype(fields: dict[str, Dtype])[source]#
Type to represent a struct data.
- Parameters:
- fieldsdict
A mapping of field names to dtypes, the dtypes can themselves be of
StructDtypetoo.
Attributes
Returns an ordered dict of column name and dtype key-value.
itemsize
Methods
from_arrow(typ)Convert a
pyarrow.StructTypetoStructDtype.to_arrow()Convert a
StructDtypeto apyarrow.StructType.Examples
>>> import cudf >>> struct_dtype = cudf.StructDtype({"a": "int64", "b": "string"}) >>> struct_dtype StructDtype({'a': dtype('int64'), 'b': dtype('O')})
A nested
StructDtypecan 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')})