Teradata Package for Python Function Reference on VantageCloud Lake - array_lt - 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.array_lt = array_lt(self, other, lower_bound=None, upper_bound=None)
DESCRIPTION:
    Compare the elements of the array with another array or scalar value and
    return a boolean result for each comparison if value in the array is less than
    the other value.
 
PARAMETERS:
    other:
        Required Argument.
        Specifies the array or Python literal value to compare against.
        Note:
            * Value specified in "other" must be of the same type as the array to compare.
        Types: ColumnExpression OR Python literal
 
    lower_bound:
        Optional Argument.
        Specifies the starting index for comparison (inclusive).
        Note:
            * If specified, both "lower_bound" and "upper_bound" arguments must be provided.
        Types: int
 
    upper_bound:
        Optional Argument.
        Specifies the ending index for comparison (inclusive).
        Note:
            * If specified, both "lower_bound" and "upper_bound" arguments must be provided.
        Types: int
 
RETURNS:
    ColumnExpression
 
EXAMPLES:
    >>> from teradataml import *
    >>> load_example_data("array", "array_table")
 
    # Create a DataFrame on 'array_table'.
    >>> df = DataFrame("array_table")
    >>> df
                     arr1                   arr2                        arr3
    id                                                                      
    1    (10,20,30,40,50)     (23,200,215,40,21)  ('ab','bc','cd','ab','ef')
    4   (180,28,38,48,58)  (30,NULL,NULL,250,27)  ('mn','no',NULL,'op','pq')
    2   (150,25,35,45,55)       (28,50,95,90,26)  ('xy','yz','za','ab','xy')
    6   (16,261,36,46,56)     (29,170,160,46,25)  ('uv','xy','ab','xy','yz')
    3   (12,22,320,42,52)     (25,22,140,200,23)  ('pq','ab','ab','st','tu')
    5    (14,24,34,44,54)  (26,NULL,NULL,180,24)  ('ij','jk',NULL,'kl','lm')
 
    # Example 1: Compare if elements in array column 'arr1' are less than the corresponding
    #            elements in array column 'arr2'.
    >>> res = df.assign(lt_res = df.arr1.array_lt(df.arr2))
    >>> res
                     arr1                   arr2                        arr3             lt_res
    id                                                                                         
    1    (10,20,30,40,50)     (23,200,215,40,21)  ('ab','bc','cd','ab','ef')        (1,1,1,0,0)
    4   (180,28,38,48,58)  (30,NULL,NULL,250,27)  ('mn','no',NULL,'op','pq')  (0,NULL,NULL,1,0)
    2   (150,25,35,45,55)       (28,50,95,90,26)  ('xy','yz','za','ab','xy')        (0,1,1,1,0)
    6   (16,261,36,46,56)     (29,170,160,46,25)  ('uv','xy','ab','xy','yz')        (1,0,1,0,0)
    3   (12,22,320,42,52)     (25,22,140,200,23)  ('pq','ab','ab','st','tu')        (1,0,0,1,0)
    5    (14,24,34,44,54)  (26,NULL,NULL,180,24)  ('ij','jk',NULL,'kl','ab')  (1,NULL,NULL,1,0)
 
    # Example 2: Compare if elements in array column 'arr1' are less than a scalar value 25.
    >>> res = df.assign(lt_res = df.arr1.array_lt(25))
    >>> res
                     arr1                   arr2                        arr3       lt_res
    id                                                                               
    1    (10,20,30,40,50)     (23,200,215,40,21)  ('ab','bc','cd','ab','ef')  (1,1,0,0,0)
    4   (180,28,38,48,58)  (30,NULL,NULL,250,27)  ('mn','no',NULL,'op','pq')  (0,0,0,0,0)
    2   (150,25,35,45,55)       (28,50,95,90,26)  ('xy','yz','za','ab','xy')  (0,0,0,0,0)
    6   (16,261,36,46,56)     (29,170,160,46,25)  ('uv','xy','ab','xy','yz')  (1,0,0,0,0)
    3   (12,22,320,42,52)     (25,22,140,200,23)  ('pq','ab','ab','st','tu')  (1,1,0,0,0)
    5    (14,24,34,44,54)  (26,NULL,NULL,180,24)  ('ij','jk',NULL,'kl','ab')  (1,1,0,0,0)
 
    # Example 3: Compare the elements present in second position to fourth position in the array
    #            column 'arr1'. Check whether they are less than the scalar value 25 or not.
    >>> res = df.assign(lt_res = df.arr1.array_lt(25, lower_bound=2, upper_bound=4))
    >>> res
                     arr1                   arr2                        arr3             lt_res
    id                                                                                         
    1    (10,20,30,40,50)     (23,200,215,40,21)  ('ab','bc','cd','ab','ef')  (NULL,1,0,0,NULL)
    4   (180,28,38,48,58)  (30,NULL,NULL,250,27)  ('mn','no',NULL,'op','pq')  (NULL,0,0,0,NULL)
    2   (150,25,35,45,55)       (28,50,95,90,26)  ('xy','yz','za','ab','xy')  (NULL,0,0,0,NULL)
    6   (16,261,36,46,56)     (29,170,160,46,25)  ('uv','xy','ab','xy','yz')  (NULL,0,0,0,NULL)
    3   (12,22,320,42,52)     (25,22,140,200,23)  ('pq','ab','ab','st','tu')  (NULL,1,0,0,NULL)
    5    (14,24,34,44,54)  (26,NULL,NULL,180,24)  ('ij','jk',NULL,'kl','ab')  (NULL,1,0,0,NULL)
 
    # Example 4: Compare if elements in array column 'arr1' are less than the corresponding
    #            elements in array column 'arr2' present in third position to fifth position.
    >>> res = df.assign(lt_res = df.arr1.array_lt(df.arr2, lower_bound=3, upper_bound=5))
    >>> res
                    arr1                   arr2                        arr3                lt_res
    id                                                                                            
    1    (10,20,30,40,50)     (23,200,215,40,21)  ('ab','bc','cd','ab','ef')     (NULL,NULL,1,0,0)
    4   (180,28,38,48,58)  (30,NULL,NULL,250,27)  ('mn','no',NULL,'op','pq')  (NULL,NULL,NULL,1,0)
    2   (150,25,35,45,55)       (28,50,95,90,26)  ('xy','yz','za','ab','xy')     (NULL,NULL,1,1,0)
    6   (16,261,36,46,56)     (29,170,160,46,25)  ('uv','xy','ab','xy','yz')     (NULL,NULL,1,0,0)
    3   (12,22,320,42,52)     (25,22,140,200,23)  ('pq','ab','ab','st','tu')     (NULL,NULL,0,1,0)
    5    (14,24,34,44,54)  (26,NULL,NULL,180,24)  ('ij','jk',NULL,'kl','ab')  (NULL,NULL,NULL,1,0)