Share via


chr

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

For the corresponding Databricks SQL function, see chr function.

Syntax

from pyspark.databricks.sql import functions as dbf

dbf.chr(n=<n>)

Parameters

Parameter Type Description
n pyspark.sql.Column or str target column to compute on

Examples

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