pyspark.sql.functions.power#

pyspark.sql.functions.power(col1, col2)#

Returns the value of the first argument raised to the power of the second argument.

New in version 1.4.0.

Changed in version 3.4.0: Supports Spark Connect.

Parameters
col1str, Column or float

the base number.

col2str, Column or float

the exponent number.

Returns
Column

the base rased to the power the argument.

Examples

>>> df = spark.range(1)
>>> df.select(pow(lit(3), lit(2))).first()
Row(POWER(3, 2)=9.0)