# Teradata Package for Python Function Reference | 20.00 - div - 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 division between two ColumnExpressions.

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

RETURNS:
ColumnExpression

EXAMPLES:
>>> 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 1: Calculate the percent of investment of income and assign the
#            divided amount to new column 'percentage_investment'.
>>> df.assign(percentage_investment=(df.investment.mul(100)).truediv(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 2: Filter out the rows after diving income amount by 2 is less than 240.
>>> df[(df.income.div(2)) < 240]
start_time_column end_time_column  expenditure  income  investment
id
2           67/06/30        07/07/10        421.0   465.0       179.0
1           67/06/30        07/07/10        415.0   451.0       180.0