pyarrow.list_¶
- pyarrow.list_(value_type, int list_size=-1)¶
Create ListType instance from child data type or field.
- Parameters:
- Returns:
- list_type
DataType
- list_type
Examples
Create an instance of ListType:
>>> import pyarrow as pa >>> pa.list_(pa.string()) ListType(list<item: string>) >>> pa.list_(pa.int32(), 2) FixedSizeListType(fixed_size_list<item: int32>[2])
Use the ListType to create a scalar:
>>> pa.scalar(['foo', None], type=pa.list_(pa.string(), 2)) <pyarrow.FixedSizeListScalar: ['foo', None]>
or an array:
>>> pa.array([[1, 2], [3, 4]], pa.list_(pa.int32(), 2)) <pyarrow.lib.FixedSizeListArray object at ...> [ [ 1, 2 ], [ 3, 4 ] ]