【发布时间】:2023-03-28 09:47:01
【问题描述】:
请尽快帮我...
这是代码:
list_of_categories = categories +['Others']
print("Classification Report: \n Target: %s \n Labels: %s \n Classifier: %s:\n%s\n"
% (target,list_of_categories,classifier, metrics.classification_report(y_test, y_pred)))
df_report = pd.DataFrame(data=metrics.confusion_matrix(y_test, y_pred),columns = list_of_categories)
df_report.index = [list_of_categories]
df_report
然后我有这个错误:
/usr/local/lib/python3.7/dist-packages/pandas/core/internals/managers.py in create_block_manager_from_blocks(blocks, axes)
1679 blocks = [getattr(b, "values", b) for b in blocks]
1680 tot_items = sum(b.shape[0] for b in blocks)
-> 1681 raise construction_error(tot_items, blocks[0].shape[1:], axes, e)
ValueError: Shape of passed values is (3, 3), indices imply (3, 7)
我不明白...请帮帮我!!!
【问题讨论】:
-
请澄清您的具体问题或提供其他详细信息以准确突出您的需求。正如目前所写的那样,很难准确地说出你在问什么。
标签: python python-3.x pandas dataframe