pyspark.sql.functions.
conv
Convert a number in a string column from one base to another.
New in version 1.5.0.
Changed in version 3.4.0: Supports Spark Connect.
Column
a column to convert base for.
from base number.
to base number.
logariphm of given value.
Examples
>>> df = spark.createDataFrame([("010101",)], ['n']) >>> df.select(conv(df.n, 2, 16).alias('hex')).collect() [Row(hex='15')]