Index¶
Handle for an index attached to a NDArray or CTable.
Index objects are returned by NDArray indexing APIs such as
blosc2.NDArray.create_index(), blosc2.NDArray.index(), and
blosc2.NDArray.indexes, and by the equivalent CTable
indexing APIs. Use this handle to inspect index metadata and storage usage, or
to drop, rebuild, and compact the index. Users normally do not instantiate
Index directly.
- class blosc2.Index(array: NDArray | None, token: str, *, table=None, descriptor: dict | None = None)[source]¶
Handle for an index attached to an
blosc2.NDArray.Indexobjects are returned by NDArray indexing helpers such asblosc2.NDArray.create_index(),blosc2.NDArray.index(), andblosc2.NDArray.indexes, and by the equivalentblosc2.CTablehelpers. They expose descriptor metadata and convenience methods for dropping, rebuilding, or compacting the underlying index. Users should not instantiate this class directly.- Attributes:
cbytesTotal compressed size in bytes for this index payload.
col_nameCTable lookup key for this index target, if this is a table index.
cratioCompression ratio for this index payload.
descriptorCopy of the index descriptor dictionary.
fieldStructured-array field indexed by this handle, if any.
kindKind of index.
nameOptional human-readable name assigned at creation time.
nbytesTotal uncompressed size in bytes for this index payload.
persistentTrue when index sidecars are stored persistently on disk.
staleTrue if the index needs rebuilding before it can be reused.
targetDescriptor of the indexed target.
Methods
compact()Compact this index, merging incremental runs, and return the updated handle.
drop()Drop this index and delete its sidecar payloads.
get(k[,d])items()keys()rebuild()Rebuild this index and return the updated handle.
Return
(nbytes, cbytes, cratio)when sidecars are directly measurable.values()
- Index.descriptor¶
Copy of the index descriptor dictionary.
- Index.kind¶
Kind of index.
NDArray indexes return
blosc2.IndexKind; table indexes keep the catalog kind string used by CTable descriptors.
- Index.col_name¶
CTable lookup key for this index target, if this is a table index.
- Index.field¶
Structured-array field indexed by this handle, if any.
- Index.name¶
Optional human-readable name assigned at creation time.
- Index.target¶
Descriptor of the indexed target.
- Index.persistent¶
True when index sidecars are stored persistently on disk.
- Index.stale¶
True if the index needs rebuilding before it can be reused.
- Index.nbytes¶
Total uncompressed size in bytes for this index payload.
- Index.cbytes¶
Total compressed size in bytes for this index payload.
- Index.cratio¶
Compression ratio for this index payload.