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

docs: document how to check whether a column's values are contained in a fixed length sequence of values #10944

Open
cpcloud opened this issue Mar 6, 2025 · 1 comment
Labels
docs Documentation related issues or PRs

Comments

@cpcloud
Copy link
Member

cpcloud commented Mar 6, 2025

Discussed in #10943

Originally posted by oystesla March 6, 2025
When using filter, for a specific column, I want to check if the current value is not just one specific value, but whether it's present in a list of strings for example. I get deferred errors because the truth value hasn't been instantiated yet, unlike if I compare to a constant. I've tried find_in_set as well, but I get a SignatureValidationError?

What is the best approach here? I want to mirror what KQL is doing with this.

@cpcloud cpcloud added the docs Documentation related issues or PRs label Mar 6, 2025
@cpcloud
Copy link
Member Author

cpcloud commented Mar 6, 2025

You should be able to use the isin method for this:

In [3]: from ibis.interactive import *

In [4]: t = ex.penguins.fetch()

In [5]: t
Out[5]:
┏━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━┓
┃ species ┃ island    ┃ bill_length_mm ┃ bill_depth_mm ┃ flipper_length_mm ┃ body_mass_g ┃ sex    ┃ year  ┃
┡━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━╇━━━━━━━┩
│ string  │ string    │ float64        │ float64       │ int64             │ int64       │ string │ int64 │
├─────────┼───────────┼────────────────┼───────────────┼───────────────────┼─────────────┼────────┼───────┤
│ Adelie  │ Torgersen │           39.1 │          18.7 │               181 │        3750 │ male   │  2007 │
│ Adelie  │ Torgersen │           39.5 │          17.4 │               186 │        3800 │ female │  2007 │
│ Adelie  │ Torgersen │           40.3 │          18.0 │               195 │        3250 │ female │  2007 │
│ Adelie  │ Torgersen │           NULL │          NULL │              NULL │        NULL │ NULL   │  2007 │
│ Adelie  │ Torgersen │           36.7 │          19.3 │               193 │        3450 │ female │  2007 │
│ Adelie  │ Torgersen │           39.3 │          20.6 │               190 │        3650 │ male   │  2007 │
│ Adelie  │ Torgersen │           38.9 │          17.8 │               181 │        3625 │ female │  2007 │
│ Adelie  │ Torgersen │           39.2 │          19.6 │               195 │        4675 │ male   │  2007 │
│ Adelie  │ Torgersen │           34.1 │          18.1 │               193 │        3475 │ NULL   │  2007 │
│ Adelie  │ Torgersen │           42.0 │          20.2 │               190 │        4250 │ NULL   │  2007 │
│ …       │ …         │              … │             … │                 … │           … │ …      │     … │
└─────────┴───────────┴────────────────┴───────────────┴───────────────────┴─────────────┴────────┴───────┘

In [6]: t.year.isin([2007, 2008])
Out[6]:
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ InValues(year, (2007, 2008)) ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ boolean                      │
├──────────────────────────────┤
│ True                         │
│ True                         │
│ True                         │
│ True                         │
│ True                         │
│ True                         │
│ True                         │
│ True                         │
│ True                         │
│ True                         │
│ …                            │
└──────────────────────────────┘

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation related issues or PRs
Projects
Status: backlog
Development

No branches or pull requests

1 participant