pyspark.sql.functions.atan2

pyspark.sql.functions.atan2(col1: Union[ColumnOrName, float], col2: Union[ColumnOrName, float]) → pyspark.sql.column.Column[source]

New in version 1.4.0.

Changed in version 3.4.0: Supports Spark Connect.

Parameters
col1str, Column or float

coordinate on y-axis

col2str, Column or float

coordinate on x-axis

Returns
Column

the theta component of the point (r, theta) in polar coordinates that corresponds to the point (x, y) in Cartesian coordinates, as if computed by java.lang.Math.atan2()

Examples

>>> df = spark.range(1)
>>> df.select(atan2(lit(1), lit(2))).first()
Row(ATAN2(1, 2)=0.46364...)