gpt4 book ai didi

openrefine - 将多列中的多值单元格拆分为行(打开优化)

转载 作者:行者123 更新时间:2023-12-02 06:41:59 25 4
gpt4 key购买 nike

我一直在 Open Refine 上清理 table 。我现在是这样的:

REF                 Handle      Size        Price
2002, 2003 t-shirt1 M, L 23
3001, 3002, 3003 t-shirt2 S, M, L 24

我需要在 REF 和 Size 中拆分这些多值单元格,以便得到:

REF                 Handle      Size        Price
2002 t-shirt1 M 23
2003 t-shirt1 L 23
3001 t-shirt2 S 24
3002 t-shirt2 M 24
3003 t-shirt2 L 24

可以在 Open Refine 中执行此操作吗? “拆分多值单元格...”命令仅处理一列。谢谢你,安娜丽塔

最佳答案

是的,这是可能的:

  • 使用“,”作为分隔符拆分第一列。
  • 将第 2 列移至位置 1
  • 将您的项目显示为记录(而不是行)
  • 使用“,”作为分隔符拆分第 3 列
  • 填写第 4 栏和第 2 栏
  • 对列重新排序

这是我在 GREL 中的食谱:

[
{
"op": "core/row-removal",
"description": "Remove rows",
"engineConfig": {
"facets": [
{
"invert": false,
"expression": "row.starred",
"selectError": false,
"omitError": false,
"selectBlank": false,
"name": "Starred Rows",
"omitBlank": false,
"columnName": "",
"type": "list",
"selection": [
{
"v": {
"v": true,
"l": "true"
}
}
]
}
],
"mode": "row-based"
}
},
{
"op": "core/multivalued-cell-split",
"description": "Split multi-valued cells in column Column 1",
"columnName": "Column 1",
"keyColumnName": "Column 1",
"separator": ", ",
"mode": "plain"
},
{
"op": "core/column-move",
"description": "Move column Column 2 to position 0",
"columnName": "Column 2",
"index": 0
},
{
"op": "core/multivalued-cell-split",
"description": "Split multi-valued cells in column Column 3",
"columnName": "Column 3",
"keyColumnName": "Column 2",
"separator": ", ",
"mode": "plain"
},
{
"op": "core/fill-down",
"description": "Fill down cells in column Column 4",
"engineConfig": {
"facets": [],
"mode": "record-based"
},
"columnName": "Column 4"
},
{
"op": "core/fill-down",
"description": "Fill down cells in column Column 2",
"engineConfig": {
"facets": [],
"mode": "record-based"
},
"columnName": "Column 2"
},
{
"op": "core/column-reorder",
"description": "Reorder columns",
"columnNames": [
"Column 1",
"Column 2",
"Column 3",
"Column 4"
]
}
]

埃尔韦

关于openrefine - 将多列中的多值单元格拆分为行(打开优化),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32831582/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com