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

snowflake.snowpark.functions.to_double¶

snowflake.snowpark.functions.to_double(e: Union[Column, str], fmt: Optional[Union[Column, str]] = None) → Column[source]¶

Converts an input expression to a decimal.

Example::
>>> df = session.create_dataframe(['12', '11.3', '-90.12345'], schema=['a'])
>>> df.select(to_double(col('a')).as_('ans')).collect()
[Row(ANS=12.0), Row(ANS=11.3), Row(ANS=-90.12345)]
Copy
Example::
>>> df = session.create_dataframe(['12+', '11.3+', '90.12-'], schema=['a'])
>>> df.select(to_double(col('a'), "999.99MI").as_('ans')).collect()
[Row(ANS=12.0), Row(ANS=11.3), Row(ANS=-90.12)]
Copy