pyspark.sql.functions.conv

pyspark.sql.functions.conv(col, fromBase, toBase)[source]

Convert a number in a string column from one base to another.

New in version 1.5.0.

Examples

>>> df = spark.createDataFrame([("010101",)], ['n'])
>>> df.select(conv(df.n, 2, 16).alias('hex')).collect()
[Row(hex='15')]