Teradata Package for Python Function Reference - Overlap - 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

Product
Teradata Package for Python
Release Number
17.00
Published
November 2021
Language
English (United States)
Last Update
2021-11-19
lifecycle
previous
Product Category
Teradata Vantage
 
 
Overlap

 
Functions
       
Overlap(data1, columns1, **kwargs)
DESCRIPTION:
    The function performs Overlap analysis by combining information from multiple
    DataFrames into an analytic data set by providing counts of overlapping key
    fields among pairs of DataFrames. For example, if an analytic data set is being
    built to describe customers, it is useful to know whether the customer, account,
    and transaction tables that provide information about customers refer to the
    same customers.
 
    Given teradataml DataFrames and corresponding column names, the Overlap analysis
    determines the number of instances of that column which each pair-wise combination
    of DataFrames has in common. The same can also be performed for multiple columns
    taken together.
 
    Overlap analysis is used to process any data type that is comparable except those
    containing byte data.
    
PARAMETERS:
    data1:
        Required Argument.
        Specifies the input DataFrame containing the columns on which Overlap analysis
        is to be performed.
        Types: teradataml DataFrame
    
    columns1:
        Required Argument.
        Specifies the name(s) of the column(s), in "data1" argument, to be used in
        Overlap analysis.
        Types: str OR list of Strings (str)
    
    kwargs:
        Specifies the additional data and columns arguments that can be used with
        "data1" and "columns1" for Overlap analysis.
    
        data2, ..., dataN:
            Optional Arguments.
            Specifies the additional input DataFrames containing the columns on which
            Overlap analysis is to be performed along with "data1" and "columns1".
            Types: list of teradataml DataFrames
 
        columns2, ..., columnsN:
            Optional Arguments.
            Specifies the name(s) of the columns(s) of additional input DataFrames to be
            used in the Overlap analysis along with "data1" and "columns1".
            Types: str OR list of Strings (str)
 
        Notes:
            1.The data and columns related arguments must be in a sequence starting from
              "data2" and "columns2" respectively.
            2.For each data argument (datai), corresponding columns argument (columnsi)
              must be specified and vice-versa.
            3.The number of columns in each of the columns related arguments (including
              "columns1" argument) should be same.
    
RETURNS:
    An instance of Overlap.
    Output teradataml DataFrames can be accessed using attribute references, such as 
    OverlapObj.<attribute_name>.
    Output teradataml DataFrame attribute name is: result.
    
RAISES:
    TeradataMlException, TypeError, ValueError
    
EXAMPLES:
    #   1. To execute Vantage Analytic Library functions,
    #       a. import "valib" object from teradataml.
    #       b. set 'configure.val_install_location' to the database name where Vantage 
    #          analytic library functions are installed.
    #   2. Datasets used in these examples can be loaded using Vantage Analytic Library 
    #      installer.
    
    # Import valib object from teradataml to execute this function.
    from teradataml import valib
 
    # Set the 'configure.val_install_location' variable.
    from teradataml import configure
    configure.val_install_location = "SYSLIB"
 
    # Create required teradataml DataFrame.
    customer = DataFrame("customer")
    customer_analysis = DataFrame("customer_analysis")
    checking_tran = DataFrame("checking_tran")
    credit_tran = DataFrame("credit_tran")
    savings_tran = DataFrame("savings_tran")
    
    # Example 1: Run Overlap analysis on "cust_id" column present in the DataFrames
    #            'customer' and 'customer_analysis'.
    overlap_obj = valib.Overlap(data1=customer,
                                data2=customer_analysis,
                                columns1=["cust_id"],
                                columns2="cust_id")
 
    # Print the results.
    print(overlap_obj.result)
    
    # Example 2: Run Overlap analysis on columns "cust_id" and "tran_id" present in
    #            the DataFrames 'checking_tran', 'credit_tran' and 'savings_tran'.
    overlap_obj = valib.Overlap(data1=checking_tran,
                                data2=credit_tran,
                                data3=savings_tran,
                                columns1=["cust_id", "tran_id"],
                                columns2=["cust_id", "tran_id"],
                                columns3=["cust_id", "tran_id"])
 
    # Print the results.
    print(overlap_obj.result)