Skip to content

Commit

Permalink
added structure for header row
Browse files Browse the repository at this point in the history
  • Loading branch information
atmcgrath committed Dec 10, 2021
1 parent 5fd306d commit 357e59c
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions double-take-json-to-csv-code.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,18 @@

row_list = []

f = open('triarte-scalar-main/double-take.json')
f = open('double-take.json')
data = json.load(f)
#print(data)

# add the equivalent scalar metadata labels for each row here
header_row = [
'dcterms:source',
'?',
'dcterms:date'
'dcterms:title'
]

for item in data['objects']:
URL = (item['URL'])
Disp_Access_No = (item['Disp_Access_No'])
Expand All @@ -31,6 +39,11 @@

row_list.append(eachitem)

with open('double-take.csv', 'w', newline='') as file:
with open('output/double-take.csv', 'w', newline='') as file:
writer = csv.writer(file)
writer.writerows(row_list) # I just manually added the headers/metadata fields because I forgot how to do that in python
writer.writerow(header_row)
writer.writerows(row_list)

'''
# I just manually added the headers/metadata fields because I forgot how to do that in python
'''

1 comment on commit 357e59c

@atmcgrath
Copy link
Member Author

@atmcgrath atmcgrath commented on 357e59c Dec 10, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LindaChen23 could you please add the header row labels to the header_row list (line 11)? Thanks! #1

Please sign in to comment.