Teradata Package for Python Function Reference | 20.00 - Teradata Package for Python Function Reference - 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 - 20.00

Teradata Package for Python
Release Number
March 2024
English (United States)
Last Update
Product Category
Teradata Vantage

This document provides detailed description and complete usage information for all the functions in the Teradata® Package for Python, teradataml.

teradataml Function Categories

Categories of teradataml package functions:

  • <name>: Analytic functions available to use as class. Executing each analytical function means, generating instance of the analytic function class.
  • DataFrame.<name>: Create a teradataml DataFrame for the underlying Teradata table.
  • <name>_context: API functions that manage the connection and certain internal data structures called context.
  • <TDMLDF>.<name>: teradataml DataFrame methods available for data manipulation, preparation and exploration.


  • name is part of a function name that indicates the specific task of the function.
  • TDMLDF is teradataml DataFrame object.

teradataml Analytic Function Default Execution Locations

The teradataml analytics package includes two subpackages:

  • teradataml.analytics.mle
    Analytic functions in the teradataml.analytics.mle subpackage require your system to have the Vantage Machine Learning Engine, which is a separate machine learning legacy engine that is not part of the current standard Vantage offer. If your Vantage system does not have the required ML Engine, an error or no-op behavior will occur when functions in this subpackage are invoked.
  • teradataml.analytics.sqle

All teradataml analytic functions are in either of these two subpackages.

For Vantage 1.0 the following nine teradataml analytic functions were executed by default in the Advanced SQL Engine:

  • Attribution
  • DecisionForestPredict
  • DecisionTreePredict
  • GLMPredict
  • NaiveBayesPredict
  • NaiveBayesTextClassifierPredict
  • NPath
  • Sessionize
  • SVMSparsePredict

For Vantage 1.1 or later versions, six new functions are added to the list. The following 15 teradataml analytic functions are executed by default in the Advanced SQL Engine:

  • Antiselect
  • Attribution
  • DecisionForestPredict
  • DecisionTreePredict
  • GLMPredict
  • MovingAverage
  • NaiveBayesPredict
  • NaiveBayesTextClassifierPredict
  • NGramSplitter
  • NPath
  • Pack
  • Sessionize
  • StringSimilarity
  • SVMSparsePredict
  • Unpack

All other teradataml analytic functions are executed by default in the Teradata Machine Learning Engine.


  • Teradata recommends importing an analytic function in one of the following ways:

    • Preferred: Import from the teradataml package.
    • To choose the engine where the analytic function is used: Import from the subpackage.
  • The teradataml package includes a module (load_example_data) with datasets for the examples in analytic functions. To execute these examples, you need the following:

    • To have a connection to Teradata Vantage
    • Import the load_example_data module to load the data, using the command:
      from teradataml.data.load_example_data import load_example_data