snowflake.snowpark.functions.is_boolean

snowflake.snowpark.functions.is_boolean(col: Union[Column, str]) Column[source] (https://github.com/snowflakedb/snowpark-python/blob/v1.16.0/src/snowflake/snowpark/functions.py#L4507-L4519)

Returns true if the specified VARIANT column contains a boolean value.

Examples:

>>> from snowflake.snowpark.types import StructField, VariantType
>>> df = session.create_dataframe([[True, 'X']], schema=["a", "b"])
>>> df.select(is_boolean(to_variant(df["a"])).alias("boolean"), is_boolean(to_variant(df["b"])).alias("varchar")).collect()
[Row(BOOLEAN=True, VARCHAR=False)]
Copy
语言: 中文