-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding expm1
as expression
#12891
Comments
The numpy function https://numpy.org/doc/stable/reference/generated/numpy.expm1.html#numpy.expm1 Is a ufunc so you can use it directly such as You can monkey patch a wrapper to Expr namespace so you can use it like other polars methods
Then you could just do
|
Awesome, thanks a lot @deanm0000. |
I am re-opening this because of #13557, i.e. in a |
Description
It would be nice to be able to have
expm1
, cf. https://en.wikipedia.org/wiki/Exponential_function#Computation, available as apolars
expression. The inverselog1p
is already available as an expression.I am currently using
with an arbitrarily defined threshold of
0.1
to get a 'stable' implementation ofexpm1
but it's probably sub-optimal, because of the conditional, and a user needs to define a meaningful threshold requiring knowledge of the "region of stability" of the naiveexp(x) - 1
implementation.Would be happy to try implementing this myself, but I have little/zero knowledge of Rust and experience with the complexity/scope of adding this feature to polars - but I am happy to receive guidance and eventually try it out.
Btw, thanks a lot for creating, supporting, and making polars freely available.
The text was updated successfully, but these errors were encountered: