google-sheets - 在 Google 表格中自动创建混淆矩阵的方法?

标签 google-sheets

我在 Google 表格中有一个表格:

+---------+------------+--------+
| item_id | prediction | actual |
+---------+------------+--------+
|       1 |          1 |      1 |
|       2 |          1 |      1 |
|       3 |          1 |      0 |
|       4 |          0 |      1 |
|       5 |          0 |      0 |
|       6 |          1 |      1 |
+---------+------------+--------+

我想知道是否有一种自动获取此类摘要的方法,其中包含符合该行/列组合中指定条件的项目计数:

+----------+--------------+--------------+-------+
|          | prediction=0 | prediction=1 | total |
+----------+--------------+--------------+-------+
| actual=0 |            1 |            1 |     2 |
| actual=1 |            1 |            3 |     4 |
+----------+--------------+--------------+-------+
| total    |            2 |            4 |       |
+----------+--------------+--------------+-------+

我一直在使用 COUNTIFS 在 Google 表格中手动执行此操作,但我想知道是否有内置方法?我尝试使用数据透视表,但无法弄清楚如何让计算字段显示我想要的数据。

最佳答案

一位同事发现了这一点 - 您可以通过创建一个包含正确列和行的数据透视表并将值设置为 COUNTUNIQUE 汇总的 item_id 来实现这一点。

关于google-sheets - 在 Google 表格中自动创建混淆矩阵的方法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55871872/

相关文章:

google-sheets - 在 Google 表格中使用查找

google-sheets - GoogleFinance 在获取股票报价时经常返回 #N/A 和内部错误消息

google-apps-script - Google 脚本,根据上次修改日期删除文件夹中的文件

random - 构建一个随机行选择器来选择一行

google-apps-script - IMPORTXML 错误警报 : “Internal import error” - How to avoid the error by importing the data directly via script?

if-statement - 将数据从多列转换为行并保留 "labels"

excel - 巧妙地将数字格式化为十亿/百万/千

google-sheets - 如果 "Column A"单元格包含给定文本,如何删除 Google 表格中的行

javascript - 将行移动到新工作表中不同列的脚本

google-apps-script - 如何在发布插件之前使用多个活跃用户测试 Google Apps 脚本?