pyspark.sql.functions.unhex#
- pyspark.sql.functions.unhex(col)[source]#
Inverse of hex. Interprets each pair of characters as a hexadecimal number and converts to the byte representation of number.
Added in version 1.5.0.
Changed in version 3.4.0: Supports Spark Connect.
- Parameters:
- col
Columnor column name target column to work on. A column that evaluates to a string.
- col
- Returns:
Columnbyte representation of the given hexadecimal value. Returns a column that evaluates to a binary.
See also
Examples
>>> import pyspark.sql.functions as sf >>> df = spark.createDataFrame([('414243',)], ['a']) >>> df.select('*', sf.unhex('a')).show() +------+----------+ | a| unhex(a)| +------+----------+ |414243|[41 42 43]| +------+----------+