如何将此数据分类为correct_pred和wrong_pred?
后如何计算stats_all_score.head()
class score1 score2 score3
A 1.67 3.60 5.50
A 3.60 3.25 2.10
A 2.25 3.25 3.25
B 1.17 6.50 21.00
C 3.20 3.25 2.30
.. .. .. ..
if (stats_all_score['class'] == 'A' and stats_all_score['score1'] <= 2.20)
or (stats_all_score['class'] == 'B' and stats_all_score['score2'] <= 2.20)
or (stats_all_score['class'] == 'C' and stats_all_score['score3'] <= 2.20):
return correct_pred
else:
return wrong_pred
File "<ipython-input-16-ffc4cad0f64a>", line 3
else
^
SyntaxError: invalid syntax
答案 0 :(得分:0)
if
语句检查一个条件的结果,而不是多个条件的结果。您需要使用()
包装逻辑计算。
if (condition1 or condition2 or condition3):
return something