Teradata Package for Python Function Reference on VantageCloud Lake - like - 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.sql.DataFrameColumn.like = like(self, other, escape_char=None)
DESCRIPTION:
    Function which is used to match the pattern.
 
PARAMETERS:
    other:
        Required Argument.
        Specifies a string to match. String match is case sensitive.
        Types: str OR ColumnExpression
 
    escape_char:
        Optional Argument.
        Specifies the escape character to be used in the pattern.
        Types: str with one character
 
RETURNS:
    ColumnExpression.
 
EXAMPLES:
    # Load example data.
    >>> load_example_data("teradataml", "pattern_matching_data")
    >>> df = DataFrame('pattern_matching_data')
               data     pattern     level
    id                                   
    5       prod_01    prod_01%  Beginner
    8      log%2024        l_g%  Beginner
    2     user%2025     user!%%  Beginner
    6       prod%v2     prod!_%    Novice
    4   data%backup     data@%%  Advanced
    10     backup_9  restore!_9  Beginner
    7      log_file   log^_file  Advanced
    1    user_Alpha     user!_%  Advanced
    3     data_2024          d%    Novice
    9     temp_file    temp!__%    Novice
 
    # Example 1: Find out the records which starts with 'A' in the column 'level'.
    >>> df = df[df.level.like('A%')]
    >>> df
               data    pattern     level
    id                                  
    4   data%backup    data@%%  Advanced
    7      log_file  log^_file  Advanced
    1    user_Alpha    user!_%  Advanced
    >>>
 
    # Example 2: Create a new Column with values as -
    #            1 if value of column 'stats' starts with 'N' and third letter is 'v',
    #            0 otherwise. Do not ignore case.
    >>> from sqlalchemy.sql.expression import case as case_when
    >>> df.assign(new_col = case_when((df.level.like('N_v%').expression, 1), else_=0))
               data     pattern     level new_col
    id                                           
    3     data_2024          d%    Novice       1
    1    user_Alpha     user!_%  Advanced       0
    8      log%2024        l_g%  Beginner       0
    2     user%2025     user!%%  Beginner       0
    10     backup_9  restore!_9  Beginner       0
    9     temp_file    temp!__%    Novice       1
    6       prod%v2     prod!_%    Novice       1
    5       prod_01    prod_01%  Beginner       0
    4   data%backup     data@%%  Advanced       0
    7      log_file   log^_file  Advanced       0
    >>>
 
    # Example 3: Find out the records where the value in the 'data' column 
    #            matches the pattern specified in the 'pattern' column.
    >>> df = df[df.data.like(df.pattern)]
    >>> df
             data   pattern     level
    id                               
    3   data_2024        d%    Novice
    8    log%2024      l_g%  Beginner
    5     prod_01  prod_01%  Beginner
    >>>
 
    # Example 4: Find out the records where the value in the 'data' column
    #            matches the pattern specified in the 'pattern' column considering the
    #            escape character as '!'.
    >>> df = df[df.data.like(df.pattern, escape_char='!')]
    >>> df
              data   pattern     level
    id                                
    8     log%2024      l_g%  Beginner
    9    temp_file  temp!__%    Novice
    3    data_2024        d%    Novice
    2    user%2025   user!%%  Beginner
    1   user_Alpha   user!_%  Advanced
    5      prod_01  prod_01%  Beginner
    >>>