Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ https://semver.org/spec/v2.0.0.html. The most important bits are:

# Changelog

## 4.3.3 - unreleased

**Other changes:**

- [`tabmat.CategoricalMatrix`][tabmat.CategoricalMatrix] validates indices passed together with `categories` with NumPy's `min` and `max` instead of Python's built-in functions, which makes construction faster for large inputs.

## 4.3.2 - 2026-11-20

**Bug fix:**
Expand Down
4 changes: 2 additions & 2 deletions src/tabmat/categorical_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,9 +375,9 @@ def __init__(
if categories is not None:
self.categories = categories
indices = np.nan_to_num(cat_vec, nan=-1)
if max(indices) >= len(categories):
if indices.max() >= len(categories):
raise ValueError("Indices exceed length of categories.")
if min(indices) < -1:
if indices.min() < -1:
raise ValueError("Indices must be non-negative (or -1 for missing).")
else:
indices, self.categories = _extract_codes_and_categories(cat_vec)
Expand Down
Loading