colstore.ColStoreReader¶
- class colstore.ColStoreReader(path, *, madvise='__default__', mlock=False, backend=None, max_workers=None)[source]¶
Bases:
_ReaderBaseMemory-mapped columnar store with lazy, NumPy-style indexing.
Opening a store reads its header, creates one
np.memmapper column, and applies any requested kernel hints. Reads are performed through__getitem__, which returns a lazy view: either aColumnView(single-column) or aTableView(multi-column). The view materializes when one of itsarray/dict/recarray/framemethods is called.- Parameters:
path (str or pathlib.Path) – Path to a
.cstorefile produced bycolstore.store()orColStoreWriter.madvise (str or None, optional) – Kernel access-pattern hint applied to every column memmap. One of
"normal","sequential","random","willneed","dontneed", orNone. Defaults to the package-wide setting.mlock (bool, optional) – If
True, attempt to lock every column’s pages in RAM. Failures emit a warning rather than raising. Defaults toFalse.backend (str or None, optional) – Gather backend used for fancy-index reads (
"cpp"or"numpy").Noneuses the package-wide default. Applies to single-record stores; multi-record stores require the compiled C++ extension and always use it for fancy-index reads.max_workers (int or None, optional) – Override the package-wide thread-pool size for multi-column reads.
Noneuses the global setting (physical core count by default).
Examples
>>> ds = colstore.store(df, "data.cstore") >>> ds['price'] # ColumnView -> array() >>> ds[100:200, ['price', 'qty']] # TableView -> dict / recarray / frame
- property paths: tuple[Path, ...]¶
a one-element tuple of this reader’s
path.- Type:
The backing files