pyspark.sql.functions.
base64
Computes the BASE64 encoding of a binary column and returns it as a string column.
New in version 1.5.0.
Changed in version 3.4.0: Supports Spark Connect.
Column
target column to work on.
BASE64 encoding of string value.
Examples
>>> df = spark.createDataFrame(["Spark", "PySpark", "Pandas API"], "STRING") >>> df.select(base64("value")).show() +----------------+ | base64(value)| +----------------+ | U3Bhcms=| | UHlTcGFyaw==| |UGFuZGFzIEFQSQ==| +----------------+