pyspark.sql.functions.log2

pyspark.sql.functions.log2(col)[source]

Returns the base-2 logarithm of the argument.

New in version 1.5.0.

Examples

>>> spark.createDataFrame([(4,)], ['a']).select(log2('a').alias('log2')).collect()
[Row(log2=2.0)]