Teradata Package for Python Function Reference on VantageCloud Lake - extend - 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.extend = extend(self, num_spaces=1, index=None)
DESCRIPTION:
    Extend the space for one or more new elements in array.
 
PARAMETERS:
    num_spaces:
        Optional Argument.
        Number of spaces to extend the array.
        Default Value: 1
        Types: int
 
    index:
        Optional Argument.
        Specifies the index of the element whose value is to be copied.
        to fill the new spaces.
        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: Extend array column 'arr1' by 2 spaces.
    >>> res = df.assign(extended_arr = df.arr1.extend(num_spaces=2))
    >>> res
                     arr1                   arr2                        arr3                 extended_arr
    id                                                                                                   
    1    (10,20,30,40,50)     (23,200,215,40,21)  ('ab','bc','cd','ab','ef')   (10,20,30,40,50,NULL,NULL)
    4   (180,28,38,48,58)  (30,NULL,NULL,250,27)  ('mn','no',NULL,'op','pq')  (180,28,38,48,58,NULL,NULL)
    2   (150,25,35,45,55)       (28,50,95,90,26)  ('xy','yz','za','ab','xy')  (150,25,35,45,55,NULL,NULL)
    6   (16,261,36,46,56)     (29,170,160,46,25)  ('uv','xy','ab','xy','yz')  (16,261,36,46,56,NULL,NULL)
    3   (12,22,320,42,52)     (25,22,140,200,23)  ('pq','ab','ab','st','tu')  (12,22,320,42,52,NULL,NULL)
    5    (14,24,34,44,54)  (26,NULL,NULL,180,24)  ('ij','jk',NULL,'kl','lm')   (14,24,34,44,54,NULL,NULL)
 
    # Example 2: Extend array column 'arr1' by 3 spaces with the value of the element at index 2.
    >>> res = df.assign(extended_arr = df.arr1.extend(num_spaces=3, index=2))
    >>> res
                     arr1                   arr2                        arr3                   extended_arr
    id                                                                                                     
    1    (10,20,30,40,50)     (23,200,215,40,21)  ('ab','bc','cd','ab','ef')      (10,20,30,40,50,20,20,20)
    4   (180,28,38,48,58)  (30,NULL,NULL,250,27)  ('mn','no',NULL,'op','pq')     (180,28,38,48,58,28,28,28)
    2   (150,25,35,45,55)       (28,50,95,90,26)  ('xy','yz','za','ab','xy')     (150,25,35,45,55,25,25,25)
    6   (16,261,36,46,56)     (29,170,160,46,25)  ('uv','xy','ab','xy','yz')  (16,261,36,46,56,261,261,261)
    3   (12,22,320,42,52)     (25,22,140,200,23)  ('pq','ab','ab','st','tu')     (12,22,320,42,52,22,22,22)
    5    (14,24,34,44,54)  (26,NULL,NULL,180,24)  ('ij','jk',NULL,'kl','lm')      (14,24,34,44,54,24,24,24)