You are viewing documentation about an older version (1.16.0). View latest version

snowflake.snowpark.functions.is_decimal¶

snowflake.snowpark.functions.is_decimal(col: Union[Column, str]) → Column[source]¶

Returns true if the specified VARIANT column contains a fixed-point decimal value or integer.

Examples:

>>> import decimal
>>> from snowflake.snowpark.types import StructField, VariantType
>>> df = session.create_dataframe([[decimal.Decimal(1), "X"]], schema=["a", "b"])
>>> df.select(is_decimal(to_variant(df["a"])).alias("decimal"), is_decimal(to_variant(df["b"])).alias("varchar")).collect()
[Row(DECIMAL=True, VARCHAR=False)]
Copy