def test_correlation(join):
    # 2 el tuples can be correlated together
    # 2 el tuples can only be correlated with 3 el tuples from other table
    ret = []
    if not join:
        return ret
    cols = join[0].keys()
    cols.sort()
    for idx, col1 in enumerate(cols):
        for col2 in cols:
            if col1 <= col2:
                continue
            for statfunc in __statfuncs__:
                try:
                    cd1 = [row[col1] for row in join]
                    cd2 = [row[col2] for row in join]
                    print "\tcorrelation", col1, col2, len(cd1)
                    cd1 = map(lambda v: v or float(v) or 0, cd1)
                    cd2 = map(lambda v: v and float(v) or 0, cd2)
                    corr = statfunc(cd1, cd2)
                    if math.isnan(corr):
                        continue
                    ret.append((corr, statfunc.__name__, col1, col2))
                except Exception as e:
                    import traceback
                    traceback.print_exc()
                    print e
                    #import pdb
                    #pdb.set_trace()
    return ret
dataset/ETHPy150Open sirrice/dbtruck/dbtruck/analyze/fuzzyjoin.py/test_correlation/operator `and` -> `or`