How to merge rows in OpenRefine

后端 未结 5 1259
予麋鹿
予麋鹿 2021-01-26 10:12

How to merge rows based on some ID field?

Original Table                   New Table

ID   | Field1 | Field2       ID     | Field1 | Field2
-----|------- |------         


        
5条回答
  •  走了就别回头了
    2021-01-26 10:32

    For "ID" column use "add column based on this column":

    filter(
      cell.cross("ProjectName", "ID").cells["Field1"].value,
      v,
      isNonBlank(v)
    )[0]
    

    This will set a value for each row identified ID.

    Original Table      New Table
    
    ID   | Field1 | Field2 | Field1_ | Field2_
    -----|------- |--------|---------|--------
    A        5                  5        10
    A                10         5        10
    B        1                  1        3
    B                3          1        3
    C        4                  4        150
    C                150        4        150
    

    Remove old columns.

    After that, remove duplicates by using "blank down + facet by blank + remove matching rows" approach

提交回复
热议问题