snowflake.snowpark.functions.is_decimal

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

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
语言: 中文