pyspark.sql.functions.chr#

pyspark.sql.functions.chr(n)[source]#

Returns the ASCII character having the binary equivalent to n. If n is larger than 256 the result is equivalent to chr(n % 256).

New in version 4.1.0.

Parameters
nColumn or column name

target column to compute on.

Examples

>>> import pyspark.sql.functions as sf
>>> spark.range(60, 70).select("*", sf.chr("id")).show()
+---+-------+
| id|chr(id)|
+---+-------+
| 60|      <|
| 61|      =|
| 62|      >|
| 63|      ?|
| 64|      @|
| 65|      A|
| 66|      B|
| 67|      C|
| 68|      D|
| 69|      E|
+---+-------+