logoalt Hacker News

Numexpr: Fast numerical array expression evaluator for Python, NumPy, Pandas

17 pointsby toshlast Tuesday at 8:20 AM1 commentview on HN

Comments

short_sells_pootoday at 10:19 AM

What is the advantage of using Numexpr instead of say Polars, Numba or Taichi?

Numexpr seems to sit in a sort of odd niche of having to do relatively simple arithmetic on in-core matrix data fast. For anything more complex, Polars seems more powerful and yet easier to understand, Numba and Taichi are both much more flexible in that they can be used to implement much more complex arithmetic (at the cost of writing lower level python code).

Numexpr basically evaluates raw strings, which makes any sort of heavy usage basically immune to linting, code inspection and refactoring.

Pandas has the eval() method on the Dataframe that uses numexpr as backend, but we generally never use it because of the upper mentioned maintenance issues and the availability of better alternatives.