[英]Cannot read f1-score from csv file
i am reading classification_report file after doing 10 fold cv
for i in _all_files:
print(i)
df = pd.read_csv(i)
saved_column = df.f1-score
a = saved_column[5]
li.append(a)
print(li)
print(sum(li))
print(len(li))
print(sum(li)/len(li))
I want to add f1-score and find mean.我想添加 f1-score 并找到平均值。 But I am getting below error.
但我得到了错误。 I am able to fetch accuracy, precision and recall score using above code but bot f2-score.
我可以使用上面的代码获取准确度、精确度和召回分数,但使用 bot f2-score。 The error I am getting is "AttributeError: 'DataFrame' object has no attribute 'f1' "
我得到的错误是“AttributeError: 'DataFrame' object has no attribute 'f1'”
Use:利用:
saved_column = df['f1-score']
Hyphens are not allowed as part of an attribute name.连字符不允许作为属性名称的一部分。 That is, using the dot notation.
也就是说,使用点符号。
Maybe this way is necessary:也许这种方式是必要的:
saved_column = df['f1-score']
a = saved_column.iloc[5]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.