is_in

calista.core.functions.is_in(col_name: str, list_of_values: list[Any]) ConditionExpression

Create a condition to check if a column value is in a list of values.

Args:

col_name (str): The name of the column. list_of_values (list[Any]): The list of values to check against.

Returns:

ConditionExpression: The condition to check if the column value is in the list of values.

Example

>>> from calista import CalistaEngine
>>> from calista.core.functions import is_in
>>>
>>> calista_table = CalistaEngine(engine = "spark").load_from_dict({"ID": [1, None, 3, None]})
>>> my_rule = is_in(col_name="ID", list_of_values=[1,5])
>>> print(calista_table.analyze(rule_name="My Rule Name", condition=my_rule))
rule_name : My Rule Name
total_row_count : 4
valid_row_count : 1
valid_row_count_pct : 25.0
timestamp : 2024-01-01 00:00:00.000000