lenskit.data.matrix.SparseRowType#
- class lenskit.data.matrix.SparseRowType(dimension, value_type=pa.float32(), large=False)#
Bases:
pyarrow.ExtensionTypeData type for sparse rows stored in Arrow. Sparse rows are stored as lists of structs with
indexandcolumnfields.Stability: Internal
This API is at the internal or experimental stability level: it may change at any time, and breaking changes will not necessarily be described in the release notes. See Stability Levels for details.
- Parameters:
dimension (int)
value_type (pyarrow.DataType | None)
large (bool)
- value_type: pyarrow.DataType | None#
- index_type: SparseIndexType#
- classmethod from_type(data_type, dimension=None)#
Create a sparse row type from an Arrow data type, handling legacy struct layouts without the extension types.
- Parameters:
data_type (pyarrow.DataType) – The Arrow data type to interpret as a row type.
dimension (int | None) – The row dimension, if known from an external source. If provided and the data type also includes the dimensionality, both dimensions must match.
- Raises:
TypeError – If the data type is not a valid sparse row type.
ValueError – If there is another error, such as mismatched dimensions.
- Return type:
- classmethod __arrow_ext_deserialize__(storage_type, serialized)#
- __arrow_ext_class__()#