Lưu ý
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử đăng nhập hoặc thay đổi thư mục.
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử thay đổi thư mục.
Compute inverse tangent of the input column. Supports Spark Connect.
For the corresponding Databricks SQL function, see atan function.
Syntax
from pyspark.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.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.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|
+-----+-----------+