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.
Computes cotangent of the input column. Supports Spark Connect.
For the corresponding Databricks SQL function, see cot function.
Syntax
from pyspark.databricks.sql import functions as dbf
dbf.cot(col=<col>)
Parameters
| Parameter | Type | Description |
|---|---|---|
col |
pyspark.sql.Column or column name |
angle in radians. |
Returns
pyspark.sql.Column: cotangent of the angle.
Examples
from pyspark.databricks.sql import functions as dbf
spark.sql("SELECT * FROM VALUES (PI() / 4), (PI() / 16) AS TAB(value)").select("*", dbf.cot("value")).show()
+-------------------+------------------+
| value| COT(value)|
+-------------------+------------------+
| 0.7853981633974...|1.0000000000000...|
|0.19634954084936...| 5.027339492125...|
+-------------------+------------------+
from pyspark.databricks.sql import functions as dbf
spark.sql("SELECT * FROM VALUES (0.0), (FLOAT('NAN')), (NULL) AS TAB(value)").select("*", dbf.cot("value")).show()
+-----+----------+
|value|COT(value)|
+-----+----------+
| 0.0| Infinity|
| NaN| NaN|
| NULL| NULL|
+-----+----------+