pyspark.sql.functions.ascii#
- pyspark.sql.functions.ascii(col)[source]#
Computes the numeric value of the first character of the string column.
New in version 1.5.0.
Changed in version 3.4.0: Supports Spark Connect.
Examples
>>> from pyspark.sql import functions as sf >>> df = spark.createDataFrame(["Spark", "PySpark", "Pandas API"], "STRING") >>> df.select("*", sf.ascii("value")).show() +----------+------------+ | value|ascii(value)| +----------+------------+ | Spark| 83| | PySpark| 80| |Pandas API| 80| +----------+------------+