Skip to content

functions.py

functions.py defines pandas_udf for pandas user defined functions.

functions.py is part of pyspark.sql.pandas package.

from pyspark.sql.functions import pandas_udf

pandas_udf

pandas_udf(f=None, returnType=None, functionType=None)

pandas_udf creates a pandas user defined functions.

functionType must be one the values from PandasUDFType:

  • PythonEvalType.SQL_SCALAR_PANDAS_UDF
  • PythonEvalType.SQL_SCALAR_PANDAS_ITER_UDF
  • PythonEvalType.SQL_GROUPED_MAP_PANDAS_UDF
  • PythonEvalType.SQL_GROUPED_AGG_PANDAS_UDF
  • PythonEvalType.SQL_MAP_PANDAS_ITER_UDF
  • PythonEvalType.SQL_COGROUPED_MAP_PANDAS_UDF

Last update: 2021-03-01