Teradata Package for Python Function Reference on VantageCloud Lake - register - Teradata Package for Python - Look here for syntax, methods and examples for the functions included in the Teradata Package for Python.

Teradata® Package for Python Function Reference on VantageCloud Lake

Deployment
VantageCloud
Edition
Lake
Product
Teradata Package for Python
Release Number
20.00.00.11
Publication Date
August 2026
Content Type
Programming Reference
Publication ID
B700-4500-200K
ft:locale
en-US
ft:lastEdition
2026-08-13
ft:sourceId
FTML
dita:id
TeradataPython_FxRef_Lake_2000
Product Category
Teradata Vantage
teradataml.dataframe.functions.register = register(name, user_function, returns=VARCHAR(length=1024))
DESCRIPTION:
    Registers a user defined function (UDF).
 
PARAMETERS:
    name:
        Required Argument.
        Specifies the name of the user defined function to register.
        Types: str
        
    user_function:
        Required Argument.
        Specifies the user defined function to create a column for
        teradataml DataFrame.
        Types: function, udf
 
    returns:
        Optional Argument.
        Specifies the output column type used to register the user defined function.
        Note:
            * If 'user_function' is a udf, then return type of the udf is used as return type
              of the registered user defined function.
        Default Value: VARCHAR(1024)
        Types: teradatasqlalchemy types object
 
RETURNS:
    None
 
RAISES:
    TeradataMLException, TypeError
 
EXAMPLES:
    # Example 1: Register the user defined function to get the values upper case.
    >>> from teradataml.dataframe.functions import udf, register
    >>> @udf
    ... def to_upper(s):
    ...     if s is not None:
    ...         return s.upper()
    >>>
    # Register the created user defined function.
    >>> register("upper_val", to_upper)
    >>>
    
    # Example 2: Register a user defined function to get factorial of a number and  
    #            store the result in Integer type column.
    >>> from teradataml.dataframe.functions import udf, register
    >>> from teradatasqlalchemy.types import INTEGER
    >>> @udf 
    ... def factorial(n):
    ...    import math
    ...    return math.factorial(n)
    >>>
    # Register the created user defined function.
    >>> register("fact", factorial, INTEGER())
    >>>
 
    # Example 3: Register a Python function to get the values upper case.
    >>> from teradataml.dataframe.functions import register
    >>> def to_upper(s):
    ...     return s.upper()       
    >>>
    # Register the created Python function.
    >>> register("upper_val", to_upper)
    >>>