I'm sorry, I am new to Python and wondering if anyone can help me with extracting data? I've been trying to extract data from a df with json-content.
0 [{'@context': 'https://schema.org', '@type': '...
1 [{'@context': 'https://schema.org', '@type': '...
2 [{'@context': 'https://schema.org', '@type': '...
3 [{'@context': 'https://schema.org', '@type': '...
4 [{'@context': 'https://schema.org', '@type': '...
5 [{'@context': 'https://schema.org', '@type': '...
So rows look like this:
"[{'@context': 'https://schema.org', '@type': 'Audiobook', 'bookFormat': 'AudiobookFormat', 'name': 'Balle-Lars og mordet i Ugledige 1858', 'description': '<p>I 1858 blev der begået et mord i Ugledige mellem Præstø og Vordingborg. Den 58-årige enke Ane Marie Hemmingsdatter blev skudt.</p><p>Lars Peter Poulsen (1866-1941) var en dansk lærer og forfatter.</p>', 'image': '/images/e/200x200/0002496352.jpg', 'author': [{'@type': 'Person', 'name': 'L.P. Poulsen'}], 'readBy': [], 'publisher': {'@type:': 'Organization', 'name': ''}, 'isbn': '', 'datePublished': '', 'inLanguage': 'da', 'aggregateRating': {'@type': 'AggregateRating', 'ratingValue': 3.56, 'ratingCount': 9}}, {'@context': 'https://schema.org', '@type': 'Book', 'bookFormat': 'EBook', 'name': 'Balle-Lars og mordet i Ugledige 1858', 'description': '<p>I 1858 blev der begået et mord i Ugledige mellem Præstø og Vordingborg. Den 58-årige enke Ane Marie Hemmingsdatter blev skudt.</p>', 'image': '/images/e/200x200/0002496352.jpg', 'author': [{'@type': 'Person', 'name': 'L.P. Poulsen'}], 'publisher': {'@type:': 'Organization', 'name': 'SAGA Egmont'}, 'isbn': '9788726519877', 'datePublished': '2021-06-21', 'inLanguage': 'da', 'aggregateRating': {'@type': 'AggregateRating', 'ratingValue': 3.56, 'ratingCount': 9}}]"
What I want is to get some of the keys (e.g. 'name') from the json data, for all rows. I've been trying:
for d in unsorted:
print (d["name"])
... and variations. Is that the way to go (somehow) or should I convert everything to json and go from there?
Thank you!