Teradata Package for Python Function Reference on VantageCloud Lake - set_labels - 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.store.feature_store.models.FeatureGroup.set_labels = set_labels(self, labels)
DESCRIPTION:
    Sets the labels for FeatureGroup.
    This method is helpful, when working with analytic functions to consume the Features. 
    Note:
        Label is for the current session only.
 
PARAMETERS:
    labels:
        Required Argument.
        Specifies the name(s) of the features to refer as labels.
        Types: str or list of str
 
RETURNS:
    bool
 
RAISES:
    ValueError
 
EXAMPLES:
    >>> from teradataml import DataSource, Entity, Feature, FeatureGroup, load_example_data
    >>> load_example_data("dataframe", "admissions_train")
    # Let's create DataFrame first.
    >>> df = DataFrame("admissions_train")
 
    # create the features.
    >>> masters_feature = Feature("masters", df.masters)
    >>> gpa_feature = Feature("gpa", df.gpa)
    >>> stats_feature = Feature("stats", df.stats)
    >>> admitted_feature = Feature("admitted", df.admitted)
 
    # Create Entity.
    >>> entity = Entity("id", df.id)
 
    # Create DataSource.
    >>> data_source = DataSource("admissions_source", df)
 
    # Create FeatureGroup.
    >>> fg = FeatureGroup('Admissions',
    ...                   features=[masters_feature, gpa_feature, stats_feature, admitted_feature],
    ...                   entity=entity,
    ...                   data_source=data_source)
 
    # Example 1: Set feature 'admitted' as label.
    # Set feature 'admitted' as label.
    >>> fg.set_labels('admitted')
    True
 
    # Get the labels from FeatureGroup.
    >>> fg.labels
    Feature(name=admitted)
 
    # Example 2: Set multiple features as labels.
    # Set features 'masters' and 'gpa' as labels.
    >>> fg.set_labels(['masters', 'gpa'])
    True
 
    # Get the labels from FeatureGroup.
    >>> fg.labels
    [Feature(name=masters), Feature(name=gpa)]