Teradata Package for Python Function Reference | 20.00 - atan2 - 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
ft:locale
en-US
ft:lastEdition
2024-12-19
dita:id
TeradataPython_FxRef_Enterprise_2000
lifecycle
latest
Product Category
Teradata Vantage
teradataml.dataframe.sql.DataFrameColumn.atan2 = atan2(expression)
DESCRIPTION:
    Function computes the arctangent value based on the values in column and argument
    coordinate provided as input. The arctangent is the angle whose tangent is the value in the column.
 
NOTES:
    1. Result values return an angle between -π and π radians, excluding -π.
    2. A positive result represents a counterclockwise angle from the x-axis.
    3. A negative result represents a clockwise angle from the x-axis.
    4. If both the values from column and argument are 0, an error is returned.
    5. If the type of the column is not FLOAT, column values are converted to FLOAT
       based on implicit type conversion rules. If the value cannot be converted, an
       error is reported.
    6. Unsupported column types:
       a. BYTE or VARBYTE
       b. LOBs (BLOB or CLOB)
       c. CHARACTER or VARCHAR if the server character set is GRAPHIC
 
PARAMETERS:
    expression:
        Required Argument.
        Specifies the y-coordinate of a point to use in the arctangent calculation.
        Accepts a ColumnExpression of a numeric column or a numeric constant.
        Format for the argument: '<dataframe>.<dataframe_column>'.
 
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: Calculate arctangent value for the "gpa" column values as x-coordinate
    #            and pass it as input to DataFrame.assign().
    >>> result = df.assign(col=df.gpa.atan2(1),
    ...                    col_gpa=df.gpa.atan2(df.admitted))
    >>> print(result)
       masters   gpa     stats programming  admitted       col   col_gpa
    id
    3       no  3.70    Novice    Beginner         1  0.263964  0.263964
    4      yes  3.50  Beginner      Novice         1  0.278300  0.278300
    2      yes  3.76  Beginner    Beginner         0  0.259940  0.000000
    1      yes  3.95  Beginner    Beginner         0  0.247955  0.000000
 
    # Example 2: Filter the rows where arctangent of values in "gpa" column
    #            and argument are greater than 0.4.
    >>> print(df[df.gpa.atan2(1) > 0.26])
       masters  gpa     stats programming  admitted
    id
    4      yes  3.5  Beginner      Novice         1
    3       no  3.7    Novice    Beginner         1