将列导入现有的OpenRefine项目

时间:2015-09-13 04:01:06

标签: openrefine import-from-csv

如何将外部.csv文件中的列添加到现有项目中?

我试图在线找到解决方案,但我没有成功。

1 个答案:

答案 0 :(得分:1)

使用您提供的文件,我在不到一分钟的时间内完成了这项工作。

我有一个项目,有一列:official documentation

如果您了解一点Python,请尝试Jython。 修改列> 根据此列添加列并选择语言:Jython ,如下所示:

premier

import csv 
#we are going to use DictReader to transform our imported rows into dict, 
#so we can latter just refer to the column we want by its key i.e header
rows = csv.DictReader(open('/home/yourusername/Downloads/example.csv'), delimiter=",")  
for row in rows:
        return row['Comprar'] #'comprar' is the header of the column i want