how will i just get 'Spongebob Squarepants' from this:
[{'characters': [{'id': 'Spongebob Squarepants', 'name': 'Spongebob Squarepants'}]}]
i've tried doing
data['characters']['id']
and
data['characters']['name']
but it resulted in the error
TypeError: list indices must be integers or slices, not str
And when I saved it to a dataframe the character column becomes this whole string
[{'id': 'Spongebob Squarepants', 'name': 'Spongebob Squarepants'}]}]
Thank you!
data['characters'] is a list, so you'd have to do:
data['characters'][0]['id']