SPRKPY1015

pyspark.sql.functions.atanh

Message: pyspark.sql.functions.atanh has a workaround

Category: Warning.

Description

This issue appears when the tool detects the usage of pyspark.sql.functions.atanh which has a workaround.

Scenario

Input

On this example pyspark calculates the atanh for a dataframe by using pyspark.sql.functions.atanh.

from pyspark.sql import SparkSession
from pyspark.sql.functions import atanh
spark = SparkSession.builder.getOrCreate()
data = [['V1', 0.14],
        ['V2', 0.32],
        ['V3', 0.4],
        ['V4', -0.36]]

columns = ['Paremeter', 'value']
df = spark.createDataFrame(data, columns)
df_result = df.withColumn("atanh_value", atanh(df["value"]))

Output

SMA returns the EWI SPRKPY1015 over the line where atanh is used, so you can use to identify where to fix.

Recommended fix

There is no direct "atanh" implementation but "call_function" can be used instead, using "atanh" as the first parameter, and colName as the second one.

Additional recommendations

Last updated