I have a series:
350 0
254 1
490 0
688 0
393 1
30 1
and data frame:
0 outcome
0 350 1
1 254 1
2 490 0
3 688 0
4 393 0
5 30 1
Below is the code to calculate the total number of matches between the “Series” column and the “Result” in the data frame - this is what was intended. Is there any other better way besides below?
i=0
match=0
for pred in results['outcome']:
if test.values[i] == pred:
match+=1
i+=1
print match
I tried to use results['Survived'].eq(labels_test).sum()
, but the answer is incorrect. And using lambda, but the syntax is wrong.
please inform. thank
source
share