Teradata Package for Python Function Reference on VantageCloud Lake | 17.20 - isin - 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
17.20
Publication Date
November 2022
Content Type
Programming Reference
Publication ID
B700-4500-112K
ft:locale
en-US
ft:lastEdition
2024-02-21
ft:sourceId
FTML
dita:id
TeradataPython_FxRef_Lake_1720
Product Category
Teradata Vantage
teradataml.dataframe.sql.DataFrameColumn.isin = isin(self, values=None)
Function to check for the presence of values in a column.
 
PARAMETERS:
    values:
        Required Argument.
        Specifies the list of values to check for their presence in the column.
        in the provided set of values.
        Types: list
 
RETURNS:
    _SQLColumnExpression
 
RAISES:
    TypeError - If invalid type of values are passed to argument 'values'.
    ValueError - If None is passed to argument 'values'.
 
EXAMPLES:
    >>> load_example_data("dataframe","admissions_train")
    >>> df = DataFrame('admissions_train')
    >>> df
       masters   gpa     stats programming  admitted
    id
    15     yes  4.00  Advanced    Advanced         1
    7      yes  2.33    Novice      Novice         1
    22     yes  3.46    Novice    Beginner         0
    17      no  3.83  Advanced    Advanced         1
    13      no  4.00  Advanced      Novice         1
    38     yes  2.65  Advanced    Beginner         1
    26     yes  3.57  Advanced    Advanced         1
    5       no  3.44    Novice      Novice         0
    34     yes  3.85  Advanced    Beginner         0
    40     yes  3.95    Novice    Beginner         0
    >>>
 
    # Example 1: Filter results where gpa values are in any of these following values:
    #            4.0, 3.0, 2.0, 1.0, 3.5, 2.5, 1.5
    >>> df[df.gpa.isin([4.0, 3.0, 2.0, 1.0, 3.5, 2.5, 1.5])]
       masters  gpa     stats programming  admitted
    id
    31     yes  3.5  Advanced    Beginner         1
    6      yes  3.5  Beginner    Advanced         1
    13      no  4.0  Advanced      Novice         1
    4      yes  3.5  Beginner      Novice         1
    29     yes  4.0    Novice    Beginner         0
    15     yes  4.0  Advanced    Advanced         1
    36      no  3.0  Advanced      Novice         0
    >>>
 
    # Example 2: Filter results where stats values are neither 'Novice' nor 'Advanced'
    >>> df[~df.stats.isin(['Novice', 'Advanced'])]
       masters   gpa     stats programming  admitted
    id
    1      yes  3.95  Beginner    Beginner         0
    2      yes  3.76  Beginner    Beginner         0
    8       no  3.60  Beginner    Advanced         1
    4      yes  3.50  Beginner      Novice         1
    6      yes  3.50  Beginner    Advanced         1
    >>>