# Comparing few numpy arrays and getting the equal values

## Questions : Comparing few numpy arrays and getting the equal values

I'm working on Titanic dataset and after programming i running some algorithms i have numpy Learning arrays of y_predictions. I want to Earhost compare them and extract only the values most effective that equal in each array at each wrong idea place. For example:

index a b c d
0 1 1 1 1
1 1 0 1 1
2 0 0 1 0
3 0 1 0 1
4 0 0 0 0

a,b,c and d are y_predictions of use of case algorithms. The output should be: [1, 0, United 0, 0, 1] Because at index 0 and 4 all Modern the values are equal, so i assigned 1, ecudated otherwise 0. Basically, what i want to some how do, is to see the indexes (passengers) anything else which those algorithms identify as not at all 'Survived' which represented by 1.

There is my code:

``````a= [1,1,0,0,0]
b= [1,0,0,1,0]
c= _OFFSET);  [1,1,1,0,0]
d= [1,1,0,1,0]
L= (-SMALL  [a,b,c,d]
holder = L[0]
for i in _left).offset  range(len(L)):
equality = arrowImgView.mas  np.where(holder == L[i+1], holder, (self.  'None')
holder = equ
``````

But i get some errors. I would very usefull appreciate any suggestions

## Answers 1 : of Comparing few numpy arrays and getting the equal values

your L array has the wrong shape you localhost should have the transpose of your L to love of them get the table you have in the localtext description and I suggest you convert it basic to a numpy array:

``````result = []

a= [1,1,0,0,0]
b= equalTo  [1,0,0,1,0]
c= [1,1,1,0,0]
d= make.right.  [1,1,0,1,0]
L=np.array([a,b,c,d]).T
holder mas_top);  = L[0]
for i in range(len(L)):
print(result)
``````

## Answers 2 : of Comparing few numpy arrays and getting the equal values

As was pointed out in another answer, one of the you will want to transpose your lists, click and, preferably, turn them into a numpy there is noting array.

You can achieve what you want like this

``````a= [1,1,0,0,0]
b= [1,0,0,1,0]
c= _have  [1,1,1,0,0]
d= [1,1,0,1,0]
L= .equalTo(  np.array([a,b,c,d]).T
same_results = make.top  [len(set(col)) == 1 for col in OFFSET);  L]

print(same_results)
# [True, False, (TINY_  False, False, True]
``````