问题
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