acos

acos #

pyspark.sql.functions.acos(col) #

version: since 1.4

Inverse cosine of col, as if computed by java.lang.Math.acos()

acos

Runnable Code:

from pyspark.sql import functions as F
# Set up dataframe
data = [{"num": 1.0},{"num": 0.5},{"num": 0.0}]
df = spark.createDataFrame(data)
# Use function
df = (df
     .withColumn("acos", F.acos("num"))
     )
df.show()
num acos
1.0 0.0
0.5 1.0471975511965979
0.0 1.5707963267948966

Usage:

This is just a basic math function. Nothing special about it. Never used it.



returns: \_invoke_function_over_column("acos", col)

PySpark manual

tags: acosine, cosine, inverse cosine, trigonometry, trig




© 2023 PySpark Is Rad