Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Compute inverse tangent of the input column. Supports Spark Connect.
For the corresponding Databricks SQL function, see atan function.
Syntax
from pyspark.databricks.sql import functions as dbf
dbf.atan(col=<col>)
Parameters
| Parameter | Type | Description |
|---|---|---|
col |
pyspark.sql.Column or column name |
target column to compute on. |
Returns
pyspark.sql.Column: inverse tangent of col, as if computed by java.lang.Math.atan()
Examples
from pyspark.databricks.sql import functions as dbf
df = spark.createDataFrame([(-0.5,), (0.0,), (0.5,)], ["value"])
df.select("*", dbf.atan(df.value)).show()
+-----+-------------------+
|value| ATAN(value)|
+-----+-------------------+
| -0.5|-0.4636476090008...|
| 0.0| 0.0|
| 0.5| 0.4636476090008...|
+-----+-------------------+
from pyspark.databricks.sql import functions as dbf
spark.sql(
"SELECT * FROM VALUES (FLOAT('NAN')), (NULL) AS TAB(value)"
).select("*", dbf.atan("value")).show()
+-----+-----------+
|value|ATAN(value)|
+-----+-----------+
| NaN| NaN|
| NULL| NULL|
+-----+-----------+