Teradata Package for Python Function Reference - 17.00 - Teradata Package for Python Function Reference - Teradata Package for Python

Teradata® Package for Python Function Reference

Teradata Package for Python
Release Number
November 2021
Content Type
Programming Reference
Publication ID
English (United States)
Last Update

Teradata Vantage™ is our flagship analytic platform offering, which evolved from our industry-leading Teradata Database. Until references in content are updated to reflect this change, the term Teradata Database is synonymous with 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
  • 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