OpenRefine中如何将属性列值转为列名实现变长记录转置
在OpenRefine中将属性列转置为动态列名的方法
你已经完成ID列的Blank down并切换到记录模式,接下来只需几步就能实现把Attribute内容转为列名的需求:
操作步骤
- 选中Value列,点击列下拉菜单 → 选择「Transpose」→「Transpose cells in rows to columns based on column: Attribute」
- 在弹出的配置窗口中:
- 确认以「Attribute」列的内容作为新列的名称
- 勾选「Fill empty cells with blank」(确保缺失属性对应的单元格为空值)
- 点击「OK」执行转置
数据对比
初始数据
ID, Attribute, Value 1, height, 150mm 1, width, 20mm 2, height, 200mm 2, color, blue 3, mass, 5g
转置后目标数据
ID, height, width, color, mass 1, 150mm, 20mm, , 2, 200mm, , blue, 3, , , , 5g
转置完成后,可删除原「Attribute」和「Value」列,直接用生成的结构化数据创建facet或进行其他分析。
内容的提问来源于stack exchange,提问作者jcquokka88
相关产品推荐
相关产品推荐

