How to filter hail table using list of values

Hi,
I am trying to filter the hail table based on multiple conditions. The conditions are dynamic and change from file to file. We are passing those conditions on a list.

Ex: lst = [‘a’,‘b’,‘c’,‘d’,‘e’,‘f’,‘g’,‘h’,‘i’,…‘y’,‘z’]

current code snippet:
ht = ht.filter((ht[‘xyz’] == “a”) | (ht[‘xyz’] == “b”) |…| (ht[‘xyz’] == “z”) |(hl.is_missing(ht[‘xyz’])) )

Is there a way to filter using values in the list?

Regards,
Gopi

If you want to filter the table to rows where the xyz field contains a value in the list, you could do something like:

ht = ht.filter(hl.set(lst).contains(ht.xyz))

Or if you needed some more complex check using the values in the list, you could use the any method:

ht = ht.filter(hl.set(lst).any(lambda item: item == ht.xyz))