snowflake.snowpark.functions.to_double¶
- snowflake.snowpark.functions.to_double(e: Union[Column, str], fmt: Optional[Union[Column, str]] = None) Column [source] (https://github.com/snowflakedb/snowpark-python/blob/v1.26.0/snowpark-python/src/snowflake/snowpark/functions.py#L1954-L1985)¶
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)]
- 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)]