Skip to main content

csc

Computes cosecant of the input column. Supports Spark Connect.

For the corresponding Databricks SQL function, see csc function.

Syntax

Python
from pyspark.databricks.sql import functions as dbf

dbf.csc(col=<col>)

Parameters

Parameter

Type

Description

col

pyspark.sql.Column or column name

angle in radians.

Returns

pyspark.sql.Column: cosecant of the angle.

Examples

Python
from pyspark.databricks.sql import functions as dbf
spark.sql("SELECT * FROM VALUES (PI() / 2), (PI() / 4) AS TAB(value)").select("*", dbf.csc("value")).show()
Output
+------------------+------------------+
| value| CSC(value)|
+------------------+------------------+
|1.5707963267948...| 1.0|
|0.7853981633974...|1.4142135623730...|
+------------------+------------------+

Python
from pyspark.databricks.sql import functions as dbf
spark.sql("SELECT * FROM VALUES (0.0), (FLOAT('NAN')), (NULL) AS TAB(value)").select("*", dbf.csc("value")).show()
Output
+-----+----------+
|value|CSC(value)|
+-----+----------+
| 0.0| Infinity|
| NaN| NaN|
| NULL| NULL|
+-----+----------+