访问 GREL/Open Refine(或 R,Python)中特定值的列名称

Access column name for a specific value in GREL/Open Refine (or R, Python)

我正在尝试访问 Open Refine 中特定单元格的列名值,因此我可以用列名替换单元格的值。我知道 return 所有列名称的变量 row.columnNames 但是有没有办法 return 只是当前单元格的那个?

我正在尝试从中更改 CSV:

      Col 1   Col 2   Col 3
Row1          1       2
Row2  1 

对此:

      Col 1   Col 2   Col 3
Row1          Col 2   Col 3
Row2  Col 1 

if(value != NULL, GetColumNameForCurrentCellSomehow, NULL)

这样的单元格转换

如果更简单,我也可以使用 R 或 Python 来实现这个目标,但我也没有找到直接的方法。

试试 columnName

if(值!= NULL,columnName,NULL)

这似乎没有记录在帮助选项卡下或不可用。我通过查看找到了它:https://github.com/OpenRefine/OpenRefine/blob/c103cdcbff49cde90409855d45f4e50b5a8349d1/main/src/com/google/refine/expr/ExpressionUtils.java#L84