Teradata Package for Python Function Reference on VantageCloud Lake - between - 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.between = between(self, lower, upper)
DESCRIPTION:
    Evaluates whether the column value is between the lower and upper bounds.
    The lower and upper bounds are inclusive.
 
PARAMETERS:
    lower:
        Required Argument.
        Specifies the lower bound value.
        Type: ColumnExpression or str or int or float
    
    upper:
        Required Argument.
        Specifies the upper bound value.
        Type: ColumnExpression or str or int or float
 
RETURNS:
    ColumnExpression
 
EXAMPLES:
    # Load the data to run the example.
    >>> load_example_data("dataframe", "sales")
    >>> df = DataFrame("sales")
    >>> print(df)
                Feb    Jan    Mar    Apr    datetime
    accounts                                          
    Blue Inc     90.0   50.0   95.0  101.0  04/01/2017
    Alpha Co    210.0  200.0  215.0  250.0  04/01/2017
    Jones LLC   200.0  150.0  140.0  180.0  04/01/2017
    Yellow Inc   90.0    NaN    NaN    NaN  04/01/2017
    Red Inc     200.0  150.0  140.0    NaN  04/01/2017
    Orange Inc  210.0    NaN    NaN  250.0  04/01/2017
 
    # Example 1: Check if column 'Feb' is between 100 and 200.
    >>> new_df = df[df.Feb.between(100, 200)]
    >>> print(new_df)
               Feb    Jan  Mar  Apr    datetime
    accounts                                     
    Jones LLC  200.0  150  140  180.0  04/01/2017
    Red Inc    200.0  150  140    NaN  04/01/2017
 
    # Example 2: Check if column 'datetime' is between '01-01-2017' and '30-01-2017'.
    >>> new_df = df[df.datetime.between('01-01-2017', '30-01-2017')]
    >>> print(new_df)
                Feb    Jan    Mar    Apr    datetime
    accounts                                          
    Jones LLC   200.0  150.0  140.0  180.0  04/01/2017
    Blue Inc     90.0   50.0   95.0  101.0  04/01/2017
    Yellow Inc   90.0    NaN    NaN    NaN  04/01/2017
    Red Inc     200.0  150.0  140.0    NaN  04/01/2017
    Alpha Co    210.0  200.0  215.0  250.0  04/01/2017
    Orange Inc  210.0    NaN    NaN  250.0  04/01/2017