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.
Computes sine of the input column. Supports Spark Connect.
For the corresponding Databricks SQL function, see sin function.
Syntax
from pyspark.databricks.sql import functions as dbf
dbf.sin(col=<col>)
Parameters
| Parameter | Type | Description |
|---|---|---|
col |
pyspark.sql.Column or column name |
target column to compute on. |
Returns
pyspark.sql.Column: sine of the angle, as if computed by java.lang.Math.sin()
Examples
from pyspark.databricks.sql import functions as dbf
spark.sql(
"SELECT * FROM VALUES (0.0), (PI() / 2), (PI() / 4) AS TAB(value)"
).select("*", dbf.sin("value")).show()
+------------------+------------------+
| value| SIN(value)|
+------------------+------------------+
| 0.0| 0.0|
|1.5707963267948...| 1.0|
|0.7853981633974...|0.7071067811865...|
+------------------+------------------+
from pyspark.databricks.sql import functions as dbf
spark.sql(
"SELECT * FROM VALUES (FLOAT('NAN')), (NULL) AS TAB(value)"
).select("*", dbf.sin("value")).show()
+-----+----------+
|value|SIN(value)|
+-----+----------+
| NaN| NaN|
| NULL| NULL|
+-----+----------+