Skip to main content

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

Python
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

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