ListArray¶
Overview¶
ListArray is a row-oriented container for variable-length list cells.
It is the natural public container for list-valued blosc2.CTable
columns, but it is also useful on its own whenever you want typed,
row-addressable list data.
Internally, ListArray uses one of two lower-level backends:
blosc2.BatchArrayfor append/scan-oriented workloadsblosc2.ObjectArrayfor simpler row-level replacement semantics
Quick example¶
import blosc2
arr = blosc2.ListArray(
item_spec=blosc2.string(max_length=16),
nullable=True,
storage="batch",
urlpath="ingredients.b2b",
mode="w",
)
arr.append(["salt", "sugar"])
arr.append([])
arr.append(None)
print(arr[0])
print(arr[1:])
reopened = blosc2.open("ingredients.b2b", mode="r")
print(type(reopened).__name__)
Note
Returned Python lists are detached values. Mutating them locally does not write back to the container; reassign the whole cell instead.
- class blosc2.ListArray(spec: ListSpec | None = None, *, item_spec: SchemaSpec | None = None, nullable: bool = False, storage: str = 'batch', serializer: str = 'msgpack', batch_rows: int | None = None, items_per_block: int | None = None, _from_schunk=None, **kwargs: Any)[source]¶
A row-oriented container for list-valued data.
Backed internally by either
blosc2.ObjectArrayorblosc2.BatchArray.- Attributes:
- batch_rows
- cbytes
- contiguous
- cparams
- cratio
- dparams
- info
- info_items
- meta
- nbytes
- schunk
- urlpath
- vlmeta
Methods
append
close
copy
extend
flush
from_arrow
to_arrow
to_cframe
Constructors¶
Row Interface¶
Mutation¶
Context Manager¶
Public Members¶