Teradata Package for Python Function Reference on VantageCloud Lake - array_remove - 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_remove = array_remove(self, element)
DESCRIPTION:
    Remove all occurrences of an element from the array.
 
PARAMETERS:
    element:
        Required Argument.
        Specifies the element to remove from the array.
        Types: ColumnExpression OR Python literal
 
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: Remove element 'ab' from array column 'arr3'.
    >>> res = df.assign(modified_arr = df.arr3.array_remove(element='ab'))
    >>> res
                     arr1                   arr2                        arr3                modified_arr
    id                                                                                                  
    2   (150,25,35,45,55)       (28,50,95,90,26)  ('xy','yz','za','ab','xy')       ('xy','yz','za','xy')
    6   (16,261,36,46,56)     (29,170,160,46,25)  ('uv','xy','ab','xy','yz')       ('uv','xy','xy','yz')
    3   (12,22,320,42,52)     (25,22,140,200,23)  ('pq','ab','ab','st','tu')            ('pq','st','tu')
    4   (180,28,38,48,58)  (30,NULL,NULL,250,27)  ('mn','no',NULL,'op','pq')  ('mn','no',NULL,'op','pq')
    1    (10,20,30,40,50)     (23,200,215,40,21)  ('ab','bc','cd','ab','ef')            ('bc','cd','ef')
    5    (14,24,34,44,54)  (26,NULL,NULL,180,24)  ('ij','jk',NULL,'kl','lm')  ('ij','jk',NULL,'kl','lm')
 
    # Example 2: Remove element from column 'col' in array column 'arr2'.
    >>> tdf = df.assign(col=200)
    >>> res = tdf.assign(modified_arr = tdf.arr2.array_remove(tdf.col))
    >>> res
                     arr1                   arr2                        arr3  col           modified_arr
    id                                                                                                  
    3   (12,22,320,42,52)     (25,22,140,200,23)  ('pq','ab','ab','st','tu')  200         (25,22,140,23)
    1    (10,20,30,40,50)     (23,200,215,40,21)  ('ab','bc','cd','ab','ef')  200         (23,215,40,21)
    2   (150,25,35,45,55)       (28,50,95,90,26)  ('xy','yz','za','ab','xy')  200       (28,50,95,90,26)
    5    (14,24,34,44,54)  (26,NULL,NULL,180,24)  ('ij','jk',NULL,'kl','lm')  200  (26,NULL,NULL,180,24)
    6   (16,261,36,46,56)     (29,170,160,46,25)  ('uv','xy','ab','xy','yz')  200     (29,170,160,46,25)
    4   (180,28,38,48,58)  (30,NULL,NULL,250,27)  ('mn','no',NULL,'op','pq')  200  (30,NULL,NULL,250,27)