Pyspark UDF

PHOTO EMBED

Mon Dec 12 2022 15:41:23 GMT+0000 (Coordinated Universal Time)

Saved by @qazisaad #udf #pyspark

import pyspark.sql.types as T
@udf(returnType=T.ArrayType(T.ArrayType(T.DoubleType())))
def aad():
	return [[1.22]]

df.withColumn("new_col", aad(F.col()))
content_copyCOPY

https://sparkbyexamples.com/pyspark/pyspark-udf-user-defined-function/