pyspark.sql.functions.to_base32#

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

Computes the BASE32 (RFC 4648) encoding of a binary column and returns it as a string column.

Added in version 4.3.0.

Parameters:
colColumn or column name

target column to work on. A column that evaluates to a binary.

Returns:
Column

BASE32 encoding of the binary value. Returns a column that evaluates to a string.

Examples

>>> import pyspark.sql.functions as sf
>>> df = spark.createDataFrame([(b"foobar",)], ["value"])
>>> df.select(sf.to_base32("value").alias("r")).collect()
[Row(r='MZXW6YTBOI======')]