from_columns#
- classmethod NestedDtype.from_columns(columns: Mapping[str, pa.DataType]) Self[source]#
Make NestedDtype from a mapping of column names and list item types.
- Parameters:
columns (Mapping[str, pa.DataType]) – A mapping of column names and their item types. Since all fields are lists, the item types are inner types of the lists, not the list types themselves.
- Returns:
The constructed NestedDtype.
- Return type:
Examples
>>> dtype = NestedDtype.from_columns({"a": pa.float64(), "b": pa.int64()}) >>> dtype nested<a: [double], b: [int64]> >>> assert ( ... dtype.pyarrow_dtype ... == pa.struct({"a": pa.large_list(pa.float64()), "b": pa.large_list(pa.int64())}) ... )