Teradata Package for Python Function Reference on VantageCloud Lake - log - 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 on VantageCloud Lake

Deployment
VantageCloud
Edition
Lake
Product
Teradata Package for Python
Release Number
20.00.00.08
Published
November 2025
ft:locale
en-US
ft:lastEdition
2025-12-05
dita:id
TeradataPython_FxRef_Lake_2000
Product Category
Teradata Vantage
teradataml.dataframe.sql.DataFrameColumn.log = log(self, base)
DESCRIPTION:
    Returns the logarithm value of the column with respect to 'base'.
 
PARAMETERS:
    base:
        Required Argument.
        Specifies base of logarithm.
        Type: int or float or ColumnExpression
 
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 log values for column 'fare' using base as column 'age'.
    >>> log_df = df.assign(fare_log=df.fare.log(df.age))
    >>> print(log_df)
                age      fare  fare_log
    passenger
    326        36.0  135.6333  1.370149
    183         9.0   31.3875  1.568529
    652        18.0   23.0000  1.084807
    40         14.0   11.2417  0.916854
    774         NaN    7.2250       NaN
    366        30.0    7.2500  0.582442
    509        28.0   22.5250  0.934704
    795        25.0    7.8958  0.641942
    61         22.0    7.2292  0.639955
    469         NaN    7.7250       NaN
    >>>