Teradata Python Package Function Reference - sum - Teradata Python Package - Look here for syntax, methods and examples for the functions included in the Teradata Python Package.
Teradata® Python Package Function Reference
- Product
- Teradata Python Package
- Release Number
- 16.20
- Published
- February 2020
- Language
- English (United States)
- Last Update
- 2020-07-17
- lifecycle
- previous
- Product Category
- Teradata Vantage
- teradataml.dataframe.dataframe.DataFrame.sum = sum(self)
- DESCRIPTION:
Returns column-wise sum value of the dataframe.
PARAMETERS:
None
RETURNS:
teradataml DataFrame object with sum()
operation performed.
RAISES:
TeradataMLException
1. TDMLDF_AGGREGATE_FAILED - If sum() operation fails to
generate the column-wise summation value of the dataframe.
Possible error message:
Unable to perform 'sum()' on the dataframe.
2. TDMLDF_AGGREGATE_COMBINED_ERR - If the sum() operation
doesn't support all the columns in the dataframe.
Possible error message:
No results. Below is/are the error message(s):
All selected columns [(col2 - PERIOD_TIME), (col3 -
BLOB)] is/are unsupported for 'sum' operation.
EXAMPLES :
# Load the data to run the example.
>>> from teradataml.data.load_example_data import load_example_data
>>> load_example_data("dataframe", ["employee_info"])
# Create teradataml dataframe.
>>> df1 = DataFrame("employee_info")
>>> print(df1)
first_name marks dob joined_date
employee_no
101 abcde None None 02/12/05
100 abcd None None None
112 None None None 18/12/05
>>>
# Prints sum of the values of each column(with supported data types).
>>> df1.sum()
sum_employee_no sum_marks
0 313 None
>>>
Note : teradataml doesn't support sum operation on
character-like columns.