Teradata Package for Python Function Reference | 20.00 - array_join - 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
VMware
Enterprise
IntelliFlex
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_Enterprise_2000
Product Category
Teradata Vantage
teradataml.dataframe.sql.DataFrameColumn.array_join = array_join(self, delimiter=',', null_replacement=None, varchar_length=1024)
DESCRIPTION:
    Join array elements into a string using the specified delimiter.
 
PARAMETERS:
    delimiter:
        Optional Argument.
        Specifies the delimiter to use when joining the array elements.
        Default Value: ','
        Types: str
 
    null_replacement:
        Optional Argument.
        Specifies the string to use in place of NULL elements in the array.
        Note:
            * If not specified, NULL elements are skipped in the joined string.
        Types: str
 
    varchar_length:
        Optional Argument.
        Specifies the length of the resulting VARCHAR string.
        Default Value: 1024
        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: Join elements of array column 'arr3' with default delimiter '*'.
    >>> res = df.assign(joined_arr = df.arr3.array_join(delimiter='*'))
    >>> res
                     arr1                   arr2                        arr3      joined_arr
    id                                                                                      
    5    (14,24,34,44,54)  (26,NULL,NULL,180,24)  ('ij','jk',NULL,'kl','lm')     ij*jk*kl*lm
    2   (150,25,35,45,55)       (28,50,95,90,26)  ('xy','yz','za','ab','xy')  xy*yz*za*ab*xy
    6   (16,261,36,46,56)     (29,170,160,46,25)  ('uv','xy','ab','xy','yz')  uv*xy*ab*xy*yz
    1    (10,20,30,40,50)     (23,200,215,40,21)  ('ab','bc','cd','ab','ef')  ab*bc*cd*ab*ef
    3   (12,22,320,42,52)     (25,22,140,200,23)  ('pq','ab','ab','st','tu')  pq*ab*ab*st*tu
    4   (180,28,38,48,58)  (30,NULL,NULL,250,27)  ('mn','no',NULL,'op','pq')     mn*no*op*pq
    
    # Example 2: Join elements of array column 'arr2' with delimiter '-' and
    #            replace NULL elements with 'NA'.
    >>> res = df.assign(joined_arr = df.arr2.array_join(delimiter='-', null_replacement='NA'))
    >>> res
                     arr1                   arr2                        arr3        joined_arr
    id                                                                                        
    2   (150,25,35,45,55)       (28,50,95,90,26)  ('xy','yz','za','ab','xy')    28-50-95-90-26
    6   (16,261,36,46,56)     (29,170,160,46,25)  ('uv','xy','ab','xy','yz')  29-170-160-46-25
    3   (12,22,320,42,52)     (25,22,140,200,23)  ('pq','ab','ab','st','tu')  25-22-140-200-23
    4   (180,28,38,48,58)  (30,NULL,NULL,250,27)  ('mn','no',NULL,'op','pq')   30-NA-NA-250-27
    1    (10,20,30,40,50)     (23,200,215,40,21)  ('ab','bc','cd','ab','ef')  23-200-215-40-21
    5    (14,24,34,44,54)  (26,NULL,NULL,180,24)  ('ij','jk',NULL,'kl','lm')   26-NA-NA-180-24
 
    # Example 3: Join elements of array column 'temp_arr' with default delimiter ',' where elements
    #            in source array contains same delimiter.
    >>> from teradatasqlalchemy.types import ARRAY_VARCHAR
    >>> sdf = df.assign(temp_arr=Array(("Hi, world", "This is a test, "), atype=ARRAY_VARCHAR('[3]')))
    >>> res = sdf.assign(joined_arr = sdf.temp_arr.array_join())
    >>> res
                     arr1                   arr2                        arr3                          temp_arr                joined_arr
    id                                                                                                                                    
    5    (14,24,34,44,54)  (26,NULL,NULL,180,24)  ('ij','jk',NULL,'kl','lm')  ('Hi, world','This is a test, ')  Hi, world,This is a test, 
    2   (150,25,35,45,55)       (28,50,95,90,26)  ('xy','yz','za','ab','xy')  ('Hi, world','This is a test, ')  Hi, world,This is a test, 
    3   (12,22,320,42,52)     (25,22,140,200,23)  ('pq','ab','ab','st','tu')  ('Hi, world','This is a test, ')  Hi, world,This is a test, 
    1    (10,20,30,40,50)     (23,200,215,40,21)  ('ab','bc','cd','ab','ef')  ('Hi, world','This is a test, ')  Hi, world,This is a test, 
    4   (180,28,38,48,58)  (30,NULL,NULL,250,27)  ('mn','no',NULL,'op','pq')  ('Hi, world','This is a test, ')  Hi, world,This is a test, 
    6   (16,261,36,46,56)     (29,170,160,46,25)  ('uv','xy','ab','xy','yz')  ('Hi, world','This is a test, ')  Hi, world,This is a test,