Teradata Package for Python Function Reference | 20.00 - cbrt - 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.cbrt = cbrt(self)
DESCRIPTION:
    Function to compute cube root of the column.
    Note:
        Function computes cuberoot for column only when it's values are positive.
        Else, the function fails.
 
RETURNS:
    ColumnExpression.
 
EXAMPLES:
    # Load the data to run the example.
    >>> load_example_data("teradataml","titanic")
 
    # Create a DataFrame on 'titanic' table.
    >>> titanic = DataFrame.from_table('titanic')
    >>> df = titanic.select(["passenger", "age", "fare"])
    >>> print(df)
                age      fare
    passenger
    326        36.0  135.6333
    183         9.0   31.3875
    652        18.0   23.0000
    265         NaN    7.7500
    530        23.0   11.5000
    122         NaN    8.0500
    591        35.0    7.1250
    387         1.0   46.9000
    734        23.0   13.0000
    795        25.0    7.8958
    >>>
 
    # Example 1: Compute cuberoot values in "fare" and pass it as input to
    #           DataFrame.assign().
    >>> cbrt_df = df.assign(fare_cbrt=df.fare.cbrt())
    >>> print(cbrt_df)
                age      fare  fare_cbrt
    passenger
    326        36.0  135.6333   5.137937
    183         9.0   31.3875   3.154416
    652        18.0   23.0000   2.843867
    40         14.0   11.2417   2.240151
    774         NaN    7.2250   1.933211
    366        30.0    7.2500   1.935438
    509        28.0   22.5250   2.824153
    795        25.0    7.8958   1.991279
    61         22.0    7.2292   1.933586
    469         NaN    7.7250   1.976816
    >>>