def categorical2transactions(x):
    # type: (np.ndarray) -> List
    """
    Convert a 2D int array into a transaction list:
        [
            ['x0=1', 'x1=0', ...],
            ...
        ]
    :param x:
    :return:
    """
    assert len(x.shape) == 2

    transactions = []
    for entry in x:
        transactions.append(['x%d=%d' % (i, val) for i, val in enumerate(entry)])

    return transactions
def categorical2transactions ( x ) : assert len ( x . shape ) == 2 transactions = [ ] for entry in x : transactions . append ( [ 'x%d=%d' % ( i , val ) for i , val in enumerate ( entry ) ] ) return transactions
Convert a 2D int array into a transaction list:
        [
            ['x0=1', 'x1=0', ...],
            ...
        ]
    :param x:
    :return: