pyspark.sql.functions.char#

pyspark.sql.functions.char(col)[source]#

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

New in version 3.5.0.

Parameters
colColumn or str

Input column or strings.

Examples

>>> import pyspark.sql.functions as sf
>>> spark.range(1).select(sf.char(sf.lit(65))).show()
+--------+
|char(65)|
+--------+
|       A|
+--------+