I saw a few other similar questions with converting nested lists into a Pandas DataFrame, but my seems a bit more complicated. I currently have a list with many nests inside of it (did I say that right? lol).
For example:
[{'date': 'yyyy-mm-dd',
'total_comments':1,
'id': 123456,
'engagements_by_type': {'url clicks': 111, 'other clicks':222},
'url': 'https://hi.com/stackoverflow/is/the/best',
'posts_by_paid_unpaid': {'paid': 1, 'total': 100, 'unpaid': 99}
'organic_impressions': ,
'social_media_impressions': {'facebook': 2, 'twitter': 4, 'instagram': 4, 'twitch': 6,
'total_social_media-impressions' : 10}
{'date':....
......}]
*Notice the 'total_social_media_impressions' is a total of the nested list preceeding it, 'social_media_impressions'. This makes it very tricky.
...and so on. There are way more columns than I mentioned, but I am just trying to show a shortened example.
Does anyone know how to turn this type of long nested list into a pandas dataframe?
Update: I used a for loop to identify which columns inside the list are nested:
df = pandas.DataFrame(data)
columns = df.columns
for i in columns:
if str(df[i][0]).startswith('{'):
print('True')
else:
print('False')
Next, step is to figure out how to properly manipulate them to be in the DataFrame as a normal column and not be nested.
