Skip to content

Instantly share code, notes, and snippets.

@trevormunoz
Last active August 29, 2015 14:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trevormunoz/c95251fb161b1527685a to your computer and use it in GitHub Desktop.
Save trevormunoz/c95251fb161b1527685a to your computer and use it in GitHub Desktop.
Wikidata Suggest Example
import csvkit
from wikidata_suggest import suggest
reader = csvkit.py2.reader(
open('../data/tate-collection/collection-1.2/artist_data.csv'))
writer = csvkit.py2.writer(
open('../data/tate-collection/collection-1.2/artist_data_recon.csv', 'wb'))
for row in reader:
artist = row[1]
wikidata = suggest(artist)
if wikidata:
row.append(wikidata["url"])
else:
row.append(None)
writer.writerow(row)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment