Import columns to existing OpenRefine project

2019-06-08 19:21发布

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条回答
放荡不羁爱自由
2楼-- · 2019-06-08 20:27

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

I had a project, with one column: premier.

If you know a little Python, try Jython. Edit Column > Add column based on this column and chose Language : Jython like this:

second

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
查看更多
登录 后发表回答