Skip to content

Use NumPy min/max to validate categorical indices - #569

Merged
Martin Stancsics (stanmart) merged 1 commit into
Quantco:mainfrom
ruus77:numpy-min-max-categorical-indices
Nov 30, 2026
Merged

Martin Stancsics (stanmart) merged 1 commit into
Quantco:mainfrom
ruus77:numpy-min-max-categorical-indices

Conversation

@ruus77

@ruus77 Samuel Rus (ruus77) commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

When a CategoricalMatrix gets explicit categories, the constructor checks the indices with Python's built-in max and min. This PR uses ndarray.max() and ndarray.min() instead, which are faster on NumPy arrays because they don't loop over the elements in Python. Error messages and behavior for valid and invalid 1-D indices stay the same.


📚 Docs preview: https://tabmat--569.org.readthedocs.build/en/569/ (built from 663d381)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@stanmart
Martin Stancsics (stanmart) merged commit 8b26598 into Quantco:main Nov 30, 2026
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants