Created
November 16, 2020 22:19
-
-
Save thisismattmiller/45ff80dd33dd60853a73d07d97d59421 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import csv | |
artsts = ["Salvador Dalí", "May Ray", "Giorgio de Chirico", "Pablo Picasso", "Marcel Duchamp", "Francis Picabia", "André Masson", "Joan Miró", "Joan Miró", "René Magritte", "Paul Delvaux", "Yves Tanguy", "Matta", "Frida Kahlo", "Diego Rivera", "Diego Rivera", "Dorothea Tanning", "Leonora Carrington", "Hans Bellmer", "Roland Penrose", "Stella Snead", "Jean Arp", "Luis Buñuel", "Bridget Bate Tichenor", "Toyen", "Leonor Fini", "Dora Maar", "Kay Sage"] | |
with open("data/MetObjects.csv", "r") as artwork_csv: | |
processed_csv = csv.reader(artwork_csv) | |
with open("Met_Surrealist_Artists6.csv", "w") as csvout: | |
writeable_csv = csv.writer(csvout) | |
for row in processed_csv: | |
# make a var and then loop through all artists | |
found_it = False | |
for a in artsts: | |
if a in row[18]: | |
found_it = True | |
if found_it == True: | |
print(row[9], row[18]) #this seems to work | |
# array_title = row[9].split(',') | |
# array_artist = row[18].split(',') | |
# writeable_csv.writerow(array_title), writeable_csv.writerow(array_artist) | |
# writeable_csv.writerow(row[9][18]) ##this writes the whole document to new CSV | |
# writeable_csv.writerow(row["Title"], row["Artist Display Name"]) ##this doesn't work at all |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment