udf function decorator | teradataml DataFrame | Teradata Package for Python - udf - Function decorator - Teradata Package for Python

Teradata® Package for Python User Guide

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Teradata Package for Python
Release Number
20.00
Published
December 2024
ft:locale
en-US
ft:lastEdition
2025-01-23
dita:mapPath
nvi1706202040305.ditamap
dita:ditavalPath
plt1683835213376.ditaval
dita:id
rkb1531260709148
Product Category
Teradata Vantage

teradataml provdies a decorator udf to mark/register a Python function as a UDF to run on each row in a teradataml DataFrame. The decorated function accepts the arguments, including the column name, and returns the ColumnExpression (DataFrame Column). You can use the decorated function with DataFrame.assign() like any other function.

Input of Python function

The user defined Python function can accept as many arguments as required or no argument. It also accepts column names corresponding to the DataFrame. Thus, the user function has access to the data to process in a familiar format .

Output of Python function

The user defined Python function returns a single value for each row in the DataFrame. This value corresponds to the output of the function applied to each row’s input