Teradata Package for Python Function Reference on VantageCloud Lake - array_mul - 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_mul = array_mul(self, other, lower_bound=None, upper_bound=None)
- DESCRIPTION:
Multiply the elements of the array with another array or scalar value
element-wise and return the resultant array.
PARAMETERS:
other:
Required Argument.
Specifies the array or Python literal value to multiply with.
Note:
* Value specified in "other" must be of the same type as the array to multiply.
Types: ColumnExpression OR Python literal
lower_bound:
Optional Argument.
Specifies the starting index for multiplication (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 multiplication (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: Multiply corresponding elements of array columns 'arr1' and 'arr2'.
>>> res = df.assign(mul_res = df.arr1.array_mul(df.arr2))
>>> res
arr1 arr2 arr3 mul_res
id
1 (10,20,30,40,50) (23,200,215,40,21) ('ab','bc','cd','ab','ef') (230,4000,6450,1600,1050)
4 (180,28,38,48,58) (30,NULL,NULL,250,27) ('mn','no',NULL,'op','pq') (5400,NULL,NULL,12000,1566)
2 (150,25,35,45,55) (28,50,95,90,26) ('xy','yz','za','ab','xy') (4200,1250,3325,4050,1430)
6 (16,261,36,46,56) (29,170,160,46,25) ('uv','xy','ab','xy','yz') (464,44370,5760,2116,1400)
3 (12,22,320,42,52) (25,22,140,200,23) ('pq','ab','ab','st','tu') (300,484,44800,8400,1196)
5 (14,24,34,44,54) (26,NULL,NULL,180,24) ('ij','jk',NULL,'kl','ab') (364,NULL,NULL,7920,1296)
# Example 2: Multiply all elements in array column 'arr1' by a scalar value 3.
>>> res = df.assign(mul_res = df.arr1.array_mul(3))
>>> res
arr1 arr2 arr3 mul_res
id
1 (10,20,30,40,50) (23,200,215,40,21) ('ab','bc','cd','ab','ef') (30,60,90,120,150)
4 (180,28,38,48,58) (30,NULL,NULL,250,27) ('mn','no',NULL,'op','pq') (540,84,114,144,174)
2 (150,25,35,45,55) (28,50,95,90,26) ('xy','yz','za','ab','xy') (450,75,105,135,165)
6 (16,261,36,46,56) (29,170,160,46,25) ('uv','xy','ab','xy','yz') (48,783,108,138,168)
3 (12,22,320,42,52) (25,22,140,200,23) ('pq','ab','ab','st','tu') (36,66,960,126,156)
5 (14,24,34,44,54) (26,NULL,NULL,180,24) ('ij','jk',NULL,'kl','ab') (42,72,102,132,162)
# Example 3: Multiply a scalar value 2 to the elements present in first position to third position
# in the array column 'arr1'.
>>> res = df.assign(mul_res = df.arr1.array_mul(2, lower_bound=1, upper_bound=3))
>>> res
arr1 arr2 arr3 mul_res
id
1 (10,20,30,40,50) (23,200,215,40,21) ('ab','bc','cd','ab','ef') (20,40,60,NULL,NULL)
4 (180,28,38,48,58) (30,NULL,NULL,250,27) ('mn','no',NULL,'op','pq') (360,56,76,NULL,NULL)
2 (150,25,35,45,55) (28,50,95,90,26) ('xy','yz','za','ab','xy') (300,50,70,NULL,NULL)
6 (16,261,36,46,56) (29,170,160,46,25) ('uv','xy','ab','xy','yz') (32,522,72,NULL,NULL)
3 (12,22,320,42,52) (25,22,140,200,23) ('pq','ab','ab','st','tu') (24,44,640,NULL,NULL)
5 (14,24,34,44,54) (26,NULL,NULL,180,24) ('ij','jk',NULL,'kl','ab') (28,48,68,NULL,NULL)
# Example 4: Multiply the elements present in second position to third position in the array column
# 'arr1' with the corresponding elements in array column 'arr2'.
>>> res = df.assign(mul_res = df.arr1.array_mul(df.arr2, lower_bound=2, upper_bound=3))
>>> res
arr1 arr2 arr3 mul_res
id
1 (10,20,30,40,50) (23,200,215,40,21) ('ab','bc','cd','ab','ef') (NULL,4000,6450,NULL,NULL)
4 (180,28,38,48,58) (30,NULL,NULL,250,27) ('mn','no',NULL,'op','pq') (NULL,NULL,NULL,NULL,NULL)
2 (150,25,35,45,55) (28,50,95,90,26) ('xy','yz','za','ab','xy') (NULL,1250,3325,NULL,NULL)
6 (16,261,36,46,56) (29,170,160,46,25) ('uv','xy','ab','xy','yz') (NULL,44370,5760,NULL,NULL)
3 (12,22,320,42,52) (25,22,140,200,23) ('pq','ab','ab','st','tu') (NULL,484,44800,NULL,NULL)
5 (14,24,34,44,54) (26,NULL,NULL,180,24) ('ij','jk',NULL,'kl','ab') (NULL,NULL,NULL,NULL,NULL)