是否可以在 openrefine 上进行汇总 table?

Is it possible to make summarized table on openrefine?

我想知道是否可以像在 python 和 R 上那样在 OpenRefine 上创建值的聚合和汇总?示例:

Table 的医疗任命有 30 万条记录 病人 |年龄 |身份证预约 |值

按患者汇总和总结的结果将是: 病人 |末世 |平均值

我希望说得足够清楚,如果该功能可以在 Openrefine 上运行,那将会有很大帮助。

答案是"yes but"...有可能,但有点复杂。举个例子吧。

Id-patient,Age,Id-appointment,score
1,25,1-1,456
1,26,2-1,895
1,27,3-1,872
1,28,4-1,12
1,29,5-1,87
2,45,1-2,542
2,46,2-2,524
2,52,3-2,78
2,89,4-2,45
2,90,5-2,371

为了对每个患者进行聚合计算,您必须首先将每个患者转换为 record. To do this, move the "Id_patient" column to the beginning and use "blank down" (The id must be sorted beforehand with "Sort..." and "Reoder rows permanently")。

之后,您可以对每条记录的所有值进行计算,将其视为一个数组。

所有这些都将通过截屏视频更加清晰:

演示中使用的公式为:

GREL:

sort(row.record.cells.Age.value)[-1]

GREL:

sum(row.record.cells.score.value) / length(row.record.cells.score.value)

Python/Jython:

def avg(l):
    return sum(l, 0.0) / len(l)

return avg([x for x in row['record']['cells']['score']['value']])

如您所见,您可以使用 Open Refine 做很多事情,尤其是使用 Pyhon/Jython。但是计算不是它的主要目的。 Open Refine 主要用于探索、清理和丰富数据。它不是电子表格软件。使用 Excel 中的数据透视表,您可以更轻松地完成同样的工作。正如您可以使用 Excel 清理一些杂乱的数据,即使它不是最好的工具。