pyspark.sql.functions.log2

pyspark.sql.functions.log2(col: ColumnOrName) → pyspark.sql.column.Column

Returns the base-2 logarithm of the argument.

Examples

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