Teradata Package for Python Function Reference | 20.00 - pow - 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
Teradata Package for Python
Release Number
20.00.00.03
Published
December 2024
Language
English (United States)
Last Update
2024-12-19
dita:id
TeradataPython_FxRef_Enterprise_2000
Product Category
Teradata Vantage
teradataml.dataframe.sql.DataFrameColumn.pow = pow(expression)
DESCRIPTION:
    Function returns the value in the column raised to the power of the exponent value (expression).
 
ALTERNATE NAME:
    power
 
PARAMETERS:
    expression:
        Required Argument.
        Specifies a ColumnExpression of a numeric column or a constant value that is the exponent value.
        Format for the argument: '<dataframe>.<dataframe_column>'.
        Types: ColumnExpression, int
 
RAISES:
    TypeError, ValueError, TeradataMlException
 
RETURNS:
    DataFrameColumn
 
EXAMPLES:
    # Load the data to execute the example.
    >>> load_example_data("dataframe", "admissions_train")
    >>>
 
    # Create a DataFrame on 'admissions_train' table.
    >>> df = DataFrame("admissions_train").iloc[:4]
    >>> print(df)
       masters   gpa     stats programming  admitted
    id
    3       no  3.70    Novice    Beginner         1
    4      yes  3.50  Beginner      Novice         1
    2      yes  3.76  Beginner    Beginner         0
    1      yes  3.95  Beginner    Beginner         0
 
    # Example 1: Compute the power and pass it as input to DataFrame.assign().
    >>> res = df.assign(col_2 = df.gpa.pow(2),
    ...                    col = df.gpa.pow(df.admitted))
    >>> print(res)
       masters   gpa     stats programming  admitted  col    col_2
    id
    3       no  3.70    Novice    Beginner         1  3.7  13.6900
    4      yes  3.50  Beginner      Novice         1  3.5  12.2500
    2      yes  3.76  Beginner    Beginner         0  1.0  14.1376
    1      yes  3.95  Beginner    Beginner         0  1.0  15.6025
 
    Example 2: Executed pow() function on "admitted" column and filtered computed
    #          values which are equal to 1.0.
    >>> print(df[df.gpa.pow(df.admitted) == 1.0])
       masters   gpa     stats programming  admitted
    id
    2      yes  3.76  Beginner    Beginner         0
    1      yes  3.95  Beginner    Beginner         0