--- id: tabmat version: "4.2.1" license: unclear license_treatment: unclear maintenance: active --- # tabmat — Efficient matrix representations for working with tabular data. License: unclear · Maintenance: active · Downloads: 325.3K/mo ## What it is and what it does Tabmat provides specialized matrix classes—DenseMatrix, SparseMatrix, CategoricalMatrix, SplitMatrix, and StandardizedMatrix—designed to efficiently represent and compute on tabular data that combines dense columns, sparse columns, and one-hot-encoded categorical features. It targets statistical and econometric workflows where operations like sandwich products, matrix-vector products, and standardization are frequent bottlenecks. The library depends on formulaic, narwhals, numpy, and scipy, and aims to be a drop-in replacement for numpy.ndarray and scipy.sparse.csc_matrix where possible. The core design trades API breadth for speed and memory efficiency. Each matrix type supports a unified set of operations (matrix-vector products, sandwich products, getcol) with additional methods on individual subclasses. CategoricalMatrix exploits the structure of one-hot encoding to avoid storing redundant data. SplitMatrix combines dense, sparse, and categorical parts in a single object to accelerate multiplications across heterogeneous data. Use it for: - Estimating generalized linear models where sandwich products appear in Hessian computation - Weighted least squares with mixed-type predictors where sandwich products are central to normal equations - L1-penalized coordinate descent on subsets of columns requiring fast matrix-vector products on active sets - Standardizing predictors to mean zero and unit variance while preserving sparsity structure - Building statistical algorithms on tabular data with many categorical features encoded as one-hot indicators ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Provides efficient matrix classes for tabular data that mix dense, sparse, and categorical columns, optimized for statistical algorithms. Yes, if you are building statistical or econometric algorithms on mixed-type tabular data and need performance beyond generic numpy/scipy. The library is actively maintained, has no known vulnerabilities, and provides a unified API across heterogeneous matrix types. License treatment is unclear, so verify licensing before use in proprietary code. ## Install pip install tabmat uv add tabmat poetry add tabmat ## Installing tabmat Before you install: Medium install friction due to compiled wheels across Python 3.10–3.13 and multiple platforms. Active maintenance with recent commits and no known vulnerabilities. Quickstart: pip install tabmat import tabmat as tm import numpy as np dense_array = np.random.normal(size=(100, 1)) matrix = tm.from_pandas(dense_array) Requires Python 3.10 or later; compiled wheels are provided for common platforms but source builds may require a C compiler. Verify before relying: - Whether standardization methods preserve sparsity structure as claimed in the description - Performance benchmarks comparing sandwich products against direct numpy/scipy approaches - Compatibility with downstream packages expecting numpy.ndarray or scipy.sparse interfaces ## Package facts - License: not declared (unclear) - Python support: supports_current - Install friction: medium - Maintenance: active - Downloads: 325.3K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags sparse matrix library, tabular data matrix representation, statistical computing matrices, categorical data encoding, sandwich product computation, weighted least squares matrix, mixed dense sparse matrices, matrix-computation, statistical-computing, sparse-data [View on SkillFed](https://skillfed.io/packages/tabmat) · [View on PyPI](https://pypi.org/project/tabmat/)