从多指数值计数绘制热图
我有一个带有多个列的熊猫数据框,其中两个是类型的bool,称为result
和predict
。
我使用以下代码获取一个多索引序列:
df.value_counts()
:
结果 | 预测 | |
---|---|---|
真实 | 886 | 28 |
FALSE 995 FALSE | 995 | |
FALSE | 35 | FALSE |
返回 | 我希望 |
能够使用Seaborn或Matplotlib绘制此混乱矩阵。
I have a pandas DataFrame with multiple columns, where two of them are of type bool and called result
and predict
.
I use the following code to get a multi-indexed series:
df.value_counts()
Which returns:
result | predict | |
---|---|---|
True | True | 886 |
False | 995 | |
False | True | 35 |
False | 28 |
I want to be able to plot this confusion matrix using seaborn or matplotlib.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
宁愿使用
crosstab
Rather use
crosstab
: