Skip to content
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

Python - Add support to the invert operator ~ to negate expressions and columns #18793

Closed
oryanperl opened this issue Sep 17, 2024 · 2 comments
Closed
Labels
enhancement New feature or an improvement of an existing feature

Comments

@oryanperl
Copy link

oryanperl commented Sep 17, 2024

Description

Add support for the pythonic syntax of ~ to check expression are false (similar to not_())
This syntax support is both syntactic sugaring and code conversion from other data engineering libraries (e.g. the pythonic Apache Spark wrapper pyspark)

note: I could and would be happy to implement this small feature myself :)

@oryanperl oryanperl added the enhancement New feature or an improvement of an existing feature label Sep 17, 2024
@cmdlineluser
Copy link
Contributor

Is this already supported?

>>> pl.select(pl.lit(True))
shape: (1, 1)
┌─────────┐
│ literal │
│ ---     │
│ bool    │
╞═════════╡
│ true    │
└─────────┘
>>> pl.select(~pl.lit(True))
shape: (1, 1)
┌─────────┐
│ literal │
│ ---     │
│ bool    │
╞═════════╡
│ false   │
└─────────┘

@oryanperl
Copy link
Author

Is this already supported?

>>> pl.select(pl.lit(True))
shape: (1, 1)
┌─────────┐
│ literal │
│ ---     │
│ bool    │
╞═════════╡
│ true    │
└─────────┘
>>> pl.select(~pl.lit(True))
shape: (1, 1)
┌─────────┐
│ literal │
│ ---     │
│ bool    │
╞═════════╡
│ false   │
└─────────┘

my bad, you are completely correct

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or an improvement of an existing feature
Projects
None yet
Development

No branches or pull requests

2 participants