I want to make a DataFrame from each of these dictionaries:
ig_dict = {'Instagram': ([{'photos': 2}], [{'videos': 1}])}
tw_dict = {'Twitter': ([{'photos': 3}], [{'videos': 7}], [{'status': 5}])}
fb_dict = {'Facebook': ([{'photos': 1}], [{'videos': 1}], [{'status': 8}])}
This is my desired output for the Dataframe:
Dataframe 1: (from ig_dict)
Instagram
photos 2
videos 1
Dataframe 2: (from tw_dict)
Twitter
photos 3
videos 7
status 5
Dataframe 3: (from fb_dict)
Facebook
photos 1
videos 1
status 8
Currently, I am using .from_dict() method:
dataframe_to_plot_ig = pd.DataFrame.from_dict({k: v for k, v in ig_dict.items()}, orient='index')
dataframe_to_plot_tw = pd.DataFrame.from_dict({k: v for k, v in tw_dict.items()}, orient='index')
dataframe_to_plot_fb = pd.DataFrame.from_dict({k: v for k, v in fb_dict.items()}, orient='index')
but instead I get the dictionary with both key and value on the DataFrame column. This is the current output:
Instagram
0 [{'photos': 2}]
1 [{'videos': 1}]
Twitter
0 [{'photos': 3}]
1 [{'videos': 7}]
2 [{'status': 5}]
Facebook
0 [{'photos': 1}]
1 [{'videos': 1}]
2 [{'status': 8}]
What kind of list comprehension that I can use for this case?