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

snowflake.snowpark.functions.ascii

snowflake.snowpark.functions.ascii(e: Union[Column, str]) Column[source] (https://github.com/snowflakedb/snowpark-python/blob/v1.16.0/src/snowflake/snowpark/functions.py#L2095-L2106)

Returns the ASCII code for the first character of a string. If the string is empty, a value of 0 is returned.

Example:

>>> df = session.create_dataframe(['!', 'A', 'a', '', 'bcd', None], schema=['a'])
>>> df.select(df.a, ascii(df.a).as_('ascii')).collect()
[Row(A='!', ASCII=33), Row(A='A', ASCII=65), Row(A='a', ASCII=97), Row(A='', ASCII=0), Row(A='bcd', ASCII=98), Row(A=None, ASCII=None)]
Copy
Language: English