Skip to content

Allow tan to be used in df.eval. #58334

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

Merged
merged 2 commits into from
Apr 22, 2024
Merged

Allow tan to be used in df.eval. #58334

merged 2 commits into from
Apr 22, 2024

Conversation

domsmrz
Copy link
Contributor

@domsmrz domsmrz commented Apr 20, 2024

@yuanx749
Copy link
Contributor

While at it, is it feasible to also add other functions? I noticed the functions supported by NumExpr here, such as conj, real, imag.

@domsmrz
Copy link
Contributor Author

domsmrz commented Apr 21, 2024

While at it, is it feasible to also add other functions? I noticed the functions supported by NumExpr here, such as conj, real, imag.

Probably, but I'd prefer to keep this PR as is, since this is pure straight-forward fix.
Adding where is discussed here: #34834 .
I can imagine that adding complex-number operation should be easier than that but I'm not sure how well pandas handles them, so I'd prefer to delegate it to separate PR (at very least it would require adding tests)

@@ -45,6 +45,7 @@
_unary_math_ops = (
"sin",
"cos",
"tan",
Copy link
Member

Choose a reason for hiding this comment

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

Can you add a test for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just by adding "tan" to the list _unary_math_ops a standard test (which is applied to all these functions) is automatically added:

@pytest.mark.parametrize("fn", _unary_math_ops)

Let me know if you meant anything more specific.

@mroeschke mroeschke added the expressions pd.eval, query label Apr 22, 2024
@domsmrz domsmrz requested a review from mroeschke April 22, 2024 18:22
@mroeschke mroeschke added this to the 3.0 milestone Apr 22, 2024
@mroeschke mroeschke merged commit cf953da into pandas-dev:main Apr 22, 2024
45 of 46 checks passed
@mroeschke
Copy link
Member

Thanks @domsmrz

kvnwng11 pushed a commit to kvnwng11/pandas that referenced this pull request Apr 22, 2024
* Allow `tan` to be used in `df.eval`.

* Whatsnew: Link issue for fixing `tan` in `eval`.
@domsmrz domsmrz deleted the fix-tan branch April 22, 2024 19:16
pmhatre1 pushed a commit to pmhatre1/pandas-pmhatre1 that referenced this pull request May 7, 2024
* Allow `tan` to be used in `df.eval`.

* Whatsnew: Link issue for fixing `tan` in `eval`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
expressions pd.eval, query
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: Unsupported operations
3 participants