from pyspark.sql.types import DoubleType
udf = UserDefinedFunction(numpy.random.normal, DoubleType())
df_with_new_column = df.withColumn('new', udf())
Functions from Python packages for udf() of Spark dataframe