snowflake.snowpark.functions.as_boolean¶
- snowflake.snowpark.functions.as_boolean(variant: Union[snowflake.snowpark.column.Column, str]) Column [source]¶
Casts a VARIANT value to a boolean.
- Parameters:
variant (ColumnOrName) – A Column or column name containing VARIANT values to be cast to boolean.
- Returns:
ColumnL The boolean values cast from the VARIANT input.
- Example::
>>> from snowflake.snowpark.functions import to_variant, to_boolean >>> df = session.create_dataframe([ ... [True], ... [False] ... ], schema=["a"]) >>> df.select(as_boolean(to_variant(to_boolean(df["a"]))).alias("result")).collect() [Row(RESULT=True), Row(RESULT=False)]