Answers for "how to compare two arrays in python"

5

how to combine two arrays in python

# concatenate 2 numpy arrays: row-wise
>np.concatenate((array2D_1, array2D_2))
 
array([[ 0,  1,  2],
       [ 3,  4,  5],
       [ 6,  7,  8],
       [10, 11, 12],
       [13, 14, 15],
       [16, 17, 18]])
Posted by: Guest on April-06-2020
1

python section of array compare

def binary_isArrayInArray(main_array, compare_array):
    for i in range(len(main_array)-len(compare_array)):
        temp_array = []
        for j in range(len(compare_array)):
            temp_array.append(main_array[i + j])
        print(f'{temp_array} xor {compare_array} = {np.any(np.logical_xor(temp_array, compare_array))}')
        if np.any(np.logical_xor(temp_array, compare_array)) == False: return True

    return False
#takes in two binary arrays and looks wether the second one is part of the first one
Posted by: Guest on May-20-2021
0

python compare two arrays

a = [1, 2, 3, 4]
b = [5, 6, 7]
c = [1, 2, 3, 4]

a == b # False
a == c # True
Posted by: Guest on March-08-2021

Code answers related to "how to compare two arrays in python"

Python Answers by Framework

Browse Popular Code Answers by Language