Teradata Package for Python Function Reference on VantageCloud Lake - array_update - 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
Published
August 2026
ft:locale
en-US
ft:lastEdition
2026-08-13
dita:id
TeradataPython_FxRef_Lake_2000
Product Category
Teradata Vantage
teradataml.dataframe.sql.DataFrameColumn.array_update = array_update(self, updated_value, index=None, lower_bound=None, upper_bound=None, stride=None)
DESCRIPTION:
    Update the value at a specific index or subset of the elements in the array
    with a new value.
 
PARAMETERS:
    updated_value:
        Required Argument.
        Specifies the value to be updated in the array. 
        Types: int OR float OR str
 
    index:
        Optional Argument.
        Specifies the index of the array to be updated.
        Types: int 
 
    lower_bound:
        Optional Argument.
        Specifies the starting index for the update operation (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 the update operation (inclusive).
        Note:
            * If specified, both "lower_bound" and "upper_bound" arguments must be provided.
        Types: int
 
    stride:
        Optional Argument.
        Specifies the number of elements that should be skipped after each update.
        Note:
            * If "index" value is specified, then "stride" is ignored.
        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: Update element at index 3 in array column 'arr1' with value 999.
    >>> res = df.assign(updated_arr = df.arr1.array_update(999, index=3))
    >>> res
                     arr1                   arr2                        arr3         updated_arr
    id                                                                                          
    1    (10,20,30,40,50)     (23,200,215,40,21)  ('ab','bc','cd','ab','ef')   (10,20,999,40,50)
    4   (180,28,38,48,58)  (30,NULL,NULL,250,27)  ('mn','no',NULL,'op','pq')  (180,28,999,48,58)
    2   (150,25,35,45,55)       (28,50,95,90,26)  ('xy','yz','za','ab','xy')  (150,25,999,45,55)
    6   (16,261,36,46,56)     (29,170,160,46,25)  ('uv','xy','ab','xy','yz')  (16,261,999,46,56)
    3   (12,22,320,42,52)     (25,22,140,200,23)  ('pq','ab','ab','st','tu')   (12,22,999,42,52)
    5    (14,24,34,44,54)  (26,NULL,NULL,180,24)  ('ij','jk',NULL,'kl','lm')   (14,24,999,44,54)
 
    # Example 2: Update all elements in array column 'arr1' with value 0.
    >>> res = df.assign(updated_arr = df.arr1.array_update(0))
    >>> res
                     arr1                   arr2                        arr3  updated_arr
    id                                                                                       
    1    (10,20,30,40,50)     (23,200,215,40,21)  ('ab','bc','cd','ab','ef')  (0,0,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')  (0,0,0,0,0)
    3   (12,22,320,42,52)     (25,22,140,200,23)  ('pq','ab','ab','st','tu')  (0,0,0,0,0)
    5    (14,24,34,44,54)  (26,NULL,NULL,180,24)  ('ij','jk',NULL,'kl','lm')  (0,0,0,0,0)
 
    # Example 3: Update elements from position 2 to 4 in array column 'arr1' with value 100.
    >>> res = df.assign(updated_arr = df.arr1.array_update(100, lower_bound=2, upper_bound=4))
    >>> res
                     arr1                   arr2                        arr3           updated_arr
    id                                                                                            
    1    (10,20,30,40,50)     (23,200,215,40,21)  ('ab','bc','cd','ab','ef')   (10,100,100,100,50)
    4   (180,28,38,48,58)  (30,NULL,NULL,250,27)  ('mn','no',NULL,'op','pq')  (180,100,100,100,58)
    2   (150,25,35,45,55)       (28,50,95,90,26)  ('xy','yz','za','ab','xy')  (150,100,100,100,55)
    6   (16,261,36,46,56)     (29,170,160,46,25)  ('uv','xy','ab','xy','yz')   (16,100,100,100,56)
    3   (12,22,320,42,52)     (25,22,140,200,23)  ('pq','ab','ab','st','tu')   (12,100,100,100,52)
    5    (14,24,34,44,54)  (26,NULL,NULL,180,24)  ('ij','jk',NULL,'kl','lm')   (14,100,100,100,54)
 
    # Example 4: Update elements in the array column 'arr1'with value 50 using stride of 2.
    >>> res = df.assign(updated_arr = df.arr1.array_update(50, stride=2))
    >>> res
                     arr1                   arr2                        arr3                             updated_arr
    id                                                                                                              
    1    (10,20,30,40,50)     (23,200,215,40,21)  ('ab','bc','cd','ab','ef')   (50,20,30,50,50,NULL,50,NULL,NULL,50)
    4   (180,28,38,48,58)  (30,NULL,NULL,250,27)  ('mn','no',NULL,'op','pq')   (50,28,38,50,58,NULL,50,NULL,NULL,50)
    2   (150,25,35,45,55)       (28,50,95,90,26)  ('xy','yz','za','ab','xy')   (50,25,35,50,55,NULL,50,NULL,NULL,50)
    6   (16,261,36,46,56)     (29,170,160,46,25)  ('uv','xy','ab','xy','yz')  (50,261,36,50,56,NULL,50,NULL,NULL,50)
    3   (12,22,320,42,52)     (25,22,140,200,23)  ('pq','ab','ab','st','tu')  (50,22,320,50,52,NULL,50,NULL,NULL,50)
    5    (14,24,34,44,54)  (26,NULL,NULL,180,24)  ('ij','jk',NULL,'kl','lm')   (50,24,34,50,54,NULL,50,NULL,NULL,50)
 
    # Example 5: Update elements in the array column 'arr1' from second position to fifth position
    #            using stride of 1.
    >>> res = df.assign(updated_arr = df.arr1.array_update(0, lower_bound=2, upper_bound=5, stride=1))
    >>> res
                     arr1                   arr2                        arr3      updated_arr
    id                                                                                       
    1    (10,20,30,40,50)     (23,200,215,40,21)  ('ab','bc','cd','ab','ef')   (10,0,30,0,50)
    4   (180,28,38,48,58)  (30,NULL,NULL,250,27)  ('mn','no',NULL,'op','pq')  (180,0,38,0,58)
    2   (150,25,35,45,55)       (28,50,95,90,26)  ('xy','yz','za','ab','xy')  (150,0,35,0,55)
    6   (16,261,36,46,56)     (29,170,160,46,25)  ('uv','xy','ab','xy','yz')   (16,0,36,0,56)
    3   (12,22,320,42,52)     (25,22,140,200,23)  ('pq','ab','ab','st','tu')  (12,0,320,0,52)
    5    (14,24,34,44,54)  (26,NULL,NULL,180,24)  ('ij','jk',NULL,'kl','lm')   (14,0,34,0,54)