Σημείωση
Η πρόσβαση σε αυτή τη σελίδα απαιτεί εξουσιοδότηση. Μπορείτε να δοκιμάσετε να συνδεθείτε ή να αλλάξετε καταλόγους.
Η πρόσβαση σε αυτή τη σελίδα απαιτεί εξουσιοδότηση. Μπορείτε να δοκιμάσετε να αλλάξετε καταλόγους.
Compute the angle in radians between the positive x-axis of a plane and the point given by the coordinates Supports Spark Connect.
For the corresponding Databricks SQL function, see atan2 function.
Syntax
from pyspark.databricks.sql import functions as dbf
dbf.atan2(col1=<col1>, col2=<col2>)
Parameters
| Parameter | Type | Description |
|---|---|---|
col1 |
pyspark.sql.Column, column name or float |
coordinate on y-axis |
col2 |
pyspark.sql.Column, column name or float |
coordinate on x-axis |
Returns
pyspark.sql.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
from pyspark.databricks.sql import functions as dbf
spark.range(1).select(dbf.atan2(dbf.lit(1), dbf.lit(2))).show()
+------------------+
| ATAN2(1, 2)|
+------------------+
|0.4636476090008...|
+------------------+