cot
Computes cotangent of the input column. Supports Spark Connect.
For the corresponding Databricks SQL function, see cot function.
Syntax
Python
from pyspark.databricks.sql import functions as dbf
dbf.cot(col=<col>)
Parameters
Parameter | Type | Description |
|---|---|---|
|
| angle in radians. |
Returns
pyspark.sql.Column: cotangent of the angle.
Examples
Python
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()
Output
+-------------------+------------------+
| value| COT(value)|
+-------------------+------------------+
| 0.7853981633974...|1.0000000000000...|
|0.19634954084936...| 5.027339492125...|
+-------------------+------------------+
Python
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()
Output
+-----+----------+
|value|COT(value)|
+-----+----------+
| 0.0| Infinity|
| NaN| NaN|
| NULL| NULL|
+-----+----------+