Description
Window function is another place we can benefit from vectored udf and add another useful function to the pandas_udf suite.
Example usage (preliminary):
w = Window.partitionBy('id').rowsBetween(Window.unbounedPreceding, Window.unbounedFollowing) @pandas_udf(DoubleType()) def mean_udf(v): return v.mean() df.withColumn('v_mean', mean_udf(df.v1).over(window))