- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我的数据包括多个列——就我的目的而言——是相同的。在这些地方,我需要将多个选定列中的值组合成一个列。例如,将列名称 1、名称 2 和名称 3 合并为一个列名称。
遵循指导 here ,我正在尝试创建一个新列,其中包含来自多个列的值,如下图所示:
我相信我的 GREL 在这里应该结合 dc.contributor.author 中的值(简单的 value
因为这是从中的列我选择了编辑列> 根据此列添加列), dc.contributor.authorEN_us (cells["dc.contributor.authorEN_us"].value
)、dc.contributor.author1(cells["dc.contributor.author1"].value
)和 dc.contributor.authoren_US(cells["dc.contributor.authoren_US "].value
).
但是,我的新列不包含来自这些第二、第三或第四列的值,即使我知道这些值存在。
我的 GREL 语法是否有错误?我应该使用不同的方法来合并列吗?
在此先感谢您的帮助。
最佳答案
恐怕您一直在查看的教程既过时又不完整。问题是您在某些列中有值 null
。在 OpenRefine 中,连接(即通过 + 连接两个字符串)returns null
if one of the values is null
.
所以:
"Hello"+ ""+ "World"
给出“Hello World”。
但是
"Hello"+ null + ""+ "World"
返回 null
。
已经有endless discussions关于这个问题。直到最近,我还建议您使用:
或者:
coalesce(value,cells['dc.contributor.author1'].value, cells['dc.contributor.authorEN_us'].value, cells['dc.contributor.authoren_US'].value)
(Openrefine 3 中引入的 coalesce function 返回系列中的第一个非空值)
或:
value.toString() + cells['dc.contributor.authorEN_us'].value.toString() + cells['dc.contributor.authoren_US'].value.toString()
(将null
转为空字符串'')
但在未来的 OpenRefine 3.3(现在处于测试阶段)中,感谢@mathieu-saby,OpenRefine 将有一个菜单,让您可以轻松地合并列。你只需要 update your version . :)
关于data-cleaning - OpenRefine - 将多个列值合并到新列应该(?)工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59865732/
有没有人在 OpenRefine 中遇到过协调问题?我已经导入了美国大学和学院的列表,选择了 50 行,并尝试了 Freebase、DBpedia、OpenCorporates 对帐服务。我以前在 D
是否可以使用 GREL 在列中生成“计数器”,即累进数? 例如,我想添加 value到那个数字来为每条记录生成一个标识符。 最佳答案 OpenRefine 项目中的每一行都有一个索引 - 从零开始的序
我有一个包含图书馆目录记录的 xml 文件。我已将其导入 OpenRefine,但所有值都在一列中。我想转置它,以便记录中的每个字段都有自己的列。但是,由于 a) 每个字段都是可选的,因此并不存在于所
我正在尝试创建一个包含 true 或 false 的新列。基本上,A 列中有一个数字,介于 1 和 6 之间,如果它高于 3,我希望新列“匹配”包含真,否则包含假。在尝试以下 GREL 时使用基于列的
我在 Openrefine 中有一列,我想根据字符串中的位置在其每一行中添加一个字符串。例如:我有一个第 8 个字符的数字字符串:85285296 并想在第四位添加“-”:“8528-5296”。谁能
我正在使用 OpenRefine(以前是 Google Refine)从多个来源清理数据。我有来自不同来源的文件,其中包含公司,列定义相同,即 UNID | Name | Street
我需要在 Openrefine 中验证 if 条件内的 2 个值我已经尝试过: if(value > 5.6 | 5.6 || 5.6 or 5.6, value < -33) , "Insid
我有一个要应用于多列的转置。生成的Grel显示columnName或Base名称,但这意味着我必须编辑每列的代码。认为有一种方法可以找到列索引,并具有适用于“当前”列,按索引列出的列或所有列的代码。
我无法替换单元格中的空值。我创建了一个构面,以仅显示具有空值的单元格。然后,我去编辑单元格>转换函数,并尝试使用replace function,但它似乎没有用。 我尝试过的不同方法: replace
我有一个巨大文件,主要由图书元数据(作者、标题、日期、网址)组成。我的问题是,我想对作者姓名(经常重复:一个作者可以有数百条记录)进行操作,并且我想对这些作者中拥有超过 X 条记录的子集进行操作。 例
我想使用维基数据协调,通过获取这些语言的标签,将一列术语翻译成各种语言。使用 SPARQL,我将按语言过滤标签查询(这是在各种类似情况下建议的方法)。但是,我不知道如何使用 OpenRefine 协调
我想使用维基数据协调,通过获取这些语言的标签,将一列术语翻译成各种语言。使用 SPARQL,我将按语言过滤标签查询(这是在各种类似情况下建议的方法)。但是,我不知道如何使用 OpenRefine 协调
我有行数可变的记录和具有 7 个可能值的 A 列,所有这些都是可重复的。 我需要一个基于 A 的新列 B,显示每条记录中每个值的出现次数。每条记录中的计数都应重置。 我设法对 A 列中的行进行排序,在
我有一些包含多行的记录。我想根据第一行中的字符串为记录中的每一行指定一个唯一的 ID,其中包含原始 ID + _01 _02 _03 等等。 然后我希望计数器在下一个带有新字符串的记录开始时重置,并重
我想调查某一列为空的行。我将根据其他列中的值填充这些单元格,但我想确定哪些单元格尚未完成。 如果我在该列上创建一个过滤器,它不会执行任何操作,直到我输入一些内容 - 但我正在寻找的东西什么也没有...
我一直在 Open Refine 上清理 table 。我现在是这样的: REF Handle Size Price 2002, 2003
我有一些包含多行的记录。我想根据第一行中的字符串为记录中的每一行指定一个唯一的 ID,其中包含原始 ID + _01 _02 _03 等等。 然后我希望计数器在下一个带有新字符串的记录开始时重置,并重
我有一列名称,例如: 夸利亚,彼得罗·保罗 Bernard, of Clairvaux, Saint, or .E., Calvin F. Swingle、M Abate、Agostino、Asser
我想知道 OpenRefine 是否允许您在创建新列时访问其他行的数据。我怀疑它不会(这将是一个合理的设计原则),但可能有一个解决方案。 以下是人们可能想要做的事情的示例:将一列移动一行。 我有下表:
我正在使用 openrefine 清理一个 excel 数据集。我有大约 70 次操作,我一直在剪切和粘贴不同的数据集。我维护一个记录 ID 并导出到一个新的 excel 表。然后我使用记录 ID 重
我是一名优秀的程序员,十分优秀!