Import columns to existing OpenRefine project

时光毁灭记忆、已成空白 提交于 2019-12-08 11:33:30

问题


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.


回答1:


Using the file you provided, I did this in less than one minute.

I had a project, with one column: .

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


来源:https://stackoverflow.com/questions/32546156/import-columns-to-existing-openrefine-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!