is_negative

calista.core.functions.is_negative(col_name: str) ConditionExpression

Create a condition to check if a column value is negative.

Args:

col_name (str): The name of the column.

Returns:

ConditionExpression: The condition to check if a column value is negative.

Example

>>> from calista import CalistaEngine
>>> from calista import functions as func
>>>
>>> calista_table = CalistaEngine(engine = "spark").load_from_dict({"NUMBER": [1, 2, -3, -4]})
>>> my_rule = func.is_negative(col_name="NUMBER")
>>> print(calista_table.analyze(rule_name="My Rule Name", rule=my_rule))
rule_name : My Rule Name
total_row_count : 4
valid_row_count : 2
valid_row_count_pct : 50.0
timestamp : 2024-01-01 00:00:00.000000