将列导入现有的OpenRefine项目 [英] Import columns to existing OpenRefine project
本文介绍了将列导入现有的OpenRefine项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何将外部.csv文件中的列添加到现有项目?
How do I add a column from an external .csv file to an existing project?
我试图在线查找解决方案,但没有成功.
I tried to find the solution online, but I wasn't successful.
推荐答案
使用您提供的文件,我在不到一分钟的时间内完成了此操作.
Using the file you provided, I did this in less than one minute.
我有一个项目,其中只有一列:.
I had a project, with one column: .
如果您了解一点Python,请尝试Jython. 编辑列> 基于此列添加列,并选择 Language:Jython
If you know a little Python, try Jython. Edit Column > Add column based on this column and chose Language : Jython like this:
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
这篇关于将列导入现有的OpenRefine项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文