Teradata Python Package Function Reference - mean - 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.mean = mean(self)
- DESCRIPTION:
Returns column-wise mean value of the dataframe.
PARAMETERS:
None
RETURNS:
teradataml DataFrame object with mean()
operation performed.
RAISES:
TeradataMLException
1. TDMLDF_AGGREGATE_FAILED - If mean() operation fails to
generate the column-wise mean value of the dataframe.
Possible error message:
Unable to perform 'mean()' on the dataframe.
2. TDMLDF_AGGREGATE_COMBINED_ERR - If the mean() 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 'mean' 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
>>>
# Select only subset of columns from the DataFrame.
>>> df2 = df1.select(['employee_no', 'marks', 'first_name'])
# Prints mean value of each column(with supported data types).
>>> df2.mean()
mean_employee_no mean_marks
0 104.333333 None
>>>