Nota
Capaian ke halaman ini memerlukan kebenaran. Anda boleh cuba mendaftar masuk atau menukar direktori.
Capaian ke halaman ini memerlukan kebenaran. Anda boleh cuba menukar direktori.
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|
+-----+----------+