pyspark.sql.functions.base64¶
-
pyspark.sql.functions.
base64
(col: ColumnOrName) → pyspark.sql.column.Column[source]¶ 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.
Examples
>>> df = spark.createDataFrame(["Spark", "PySpark", "Pandas API"], "STRING") >>> df.select(base64("value")).show() +----------------+ | base64(value)| +----------------+ | U3Bhcms=| | UHlTcGFyaw==| |UGFuZGFzIEFQSQ==| +----------------+