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

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Teradata Package for Python
Release Number
20.00.00.03
Published
December 2024
ft:locale
en-US
ft:lastEdition
2024-12-19
dita:id
TeradataPython_FxRef_Enterprise_2000
lifecycle
latest
Product Category
Teradata Vantage
teradataml.store.feature_store.models.FeatureGroup.labels
DESCRIPTION:
    Get's the labels from FeatureGroup.
    Note:
        Use this function only after setting the labels using "set_labels".
 
PARAMETERS:
    None
 
RETURNS:
    Feature OR list
 
RAISES:
    None
 
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)
    >>> # Set feature 'admitted' as label.
    >>> fg.set_labels('admitted')
    True
 
    # Get the labels from FeatureGroup
    >>> fg.labels
    Feature(name=admitted)
    >>>