# Teradata Package for Python Function Reference | 20.00 - 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 - 20.00

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Release Number
20.00
Published
March 2024
Language
English (United States)
Last Update
2024-04-10
dita:id
Product Category
Compute the multiplication between two ColumnExpressions.

PARAMETERS:
other:
Required Argument.
Specifies Python literal or another ColumnExpression.
Types: ColumnExpression, Python literal

RETURNS:
ColumnExpression

EXAMPLES:
>>> df
id
13      no  4.00  Advanced      Novice         1
36      no  3.00  Advanced      Novice         0
40     yes  3.95    Novice    Beginner         0
22     yes  3.46    Novice    Beginner         0
38     yes  2.65  Advanced    Beginner         1
5       no  3.44    Novice      Novice         0
7      yes  2.33    Novice      Novice         1

# Example 1: Increase the GPA for each student by 10 % and assign
#            increased income to new column 'increased_gpa'.
>>> df.assign(increased_gpa=df.gpa + df.gpa.mul(0.1))
masters   gpa     stats programming  admitted  increased_gpa
id
22     yes  3.46    Novice    Beginner         0          3.806
5       no  3.44    Novice      Novice         0          3.784
13      no  4.00  Advanced      Novice         1          4.400
36      no  3.00  Advanced      Novice         0          3.300
34     yes  3.85  Advanced    Beginner         0          4.235
38     yes  2.65  Advanced    Beginner         1          2.915

>>> df = DataFrame("finance_data")
>>> df
start_time_column end_time_column  expenditure  income  investment
id
1           67/06/30        07/07/10        415.0   451.0       180.0
4           67/06/30        07/07/10        448.0   493.0       192.0
2           67/06/30        07/07/10        421.0   465.0       179.0
3           67/06/30        07/07/10        434.0   485.0       185.0
5           67/06/30        07/07/10        459.0   509.0       211.0

# Example 2: Calculate the percent of investment done of total income and assign the
#            final amount to new column 'percentage_investment'.
>>> df.assign(percentage_investment=(df.investment.mul(100)).div(df.income))
start_time_column end_time_column  expenditure  income  investment  percentage_investment
id
3           67/06/30        07/07/10        434.0   485.0       185.0              38.144330
2           67/06/30        07/07/10        421.0   465.0       179.0              38.494624
1           67/06/30        07/07/10        415.0   451.0       180.0              39.911308
5           67/06/30        07/07/10        459.0   509.0       211.0              41.453831
4           67/06/30        07/07/10        448.0   493.0       192.0              38.945233

# Example 3: Filter out the rows after doubling income is greater than 1000.
>>> df[(df.income * 2) > 1000]
start_time_column end_time_column  expenditure  income  investment  double_income
id
3           67/06/30        07/07/10        434.0   485.0       185.0          970.0
2           67/06/30        07/07/10        421.0   465.0       179.0          930.0
1           67/06/30        07/07/10        415.0   451.0       180.0          902.0
5           67/06/30        07/07/10        459.0   509.0       211.0         1018.0
4           67/06/30        07/07/10        448.0   493.0       192.0          986.0