snowflake.snowpark.functions.boolxor¶
- snowflake.snowpark.functions.boolxor(expr1: Union[snowflake.snowpark.column.Column, str], expr2: Union[snowflake.snowpark.column.Column, str]) Column[source]¶
- Computes the Boolean XOR of two numeric expressions (i.e. one of the expressions, but not both expressions, is True). In accordance with Boolean semantics:
Non-zero values (including negative numbers) are regarded as True.
Zero values are regarded as False.
- Parameters:
expr1 (ColumnOrName) – First numeric expression or a string name of the column.
expr2 (ColumnOrName) – Second numeric expression or a string name of the column.
- Returns:
True if exactly one of the expressions is non-zero.
False if both expressions are zero or both expressions are non-zero.
None if both expressions are None, or one expression is None and the other expression is zero.
- Example::
>>> from snowflake.snowpark.functions import col >>> df = session.create_dataframe([[2, 0], [1, -1], [0, 0], [None, 3]], schema=["a", "b"]) >>> df.select(boolxor(col("a"), col("b")).alias("result")).collect() [Row(RESULT=True), Row(RESULT=False), Row(RESULT=False), Row(RESULT=None)]