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

snowflake.snowpark.functions.as_number¶

snowflake.snowpark.functions.as_number(variant: ColumnOrName, precision: int | None = None, scale: int | None = None) → Column[source]¶

Casts a VARIANT value to a fixed-point decimal (does not match floating-point values).

Example::
>>> df = session.sql("select 1.2345::variant as a")
>>> df.select(as_number("a", 4, 1).alias("result")).show()
------------
|"RESULT"  |
------------
|1.2       |
------------
Copy