This repository provides a parser for a subset of Excel formula operations. The parsed formula can then be compiled into a Python callable and used like a native Python function.
The implementation is based on a simplified version of the Pascal parser written by Ruslan Spivak (link).
pip install git+https://github.com/yozoon/python-formula-compiler.git
>>> from formula_compiler import compile_formula
>>> fun = compile_formula("2*X")
>>> fun(21)
42
- +, -, *, /, ^, (, )
- ROUND
- X (X0), X1, X2, ... (placeholder for numeric input)
- LN
- LOG10
- EXP
- SQRT
- Trigonometric Functions:
- SIN
- COS
- TAN
- ASIN
- ACOS
- ATAN
- Hyperbolic Functions:
- SINH
- COSH
- TANH
- ASINH
- ACOSH
- ATANH
- PI()