title: List of dictionaries, and a dictionary within a dictionary
body: <p>I want to make a clean pandas dataframe from a list of dictionaries, in which the value of a key in a dictionary can also be a list of dictionaries. </p>
  
  <p>Here is my initial list:</p>
  
  <pre><code>[ {'product_id':1, 
     'categories': [{'toy_id':'x1', 'sales':50}, {'toy_id':'x2', 'sales':50}], 
     'buyers': [{'buyer_id':'y1' , 'buyer_age':22}, {'buyer_id':'y2' ,'buyer_age':31}]}]
  </code></pre>
  
  <p>Initially I convert the list to a pandas dataframe</p>
  
  <pre><code>list_pd = pd.DataFrame(list)
  </code></pre>
  
  <p>Although this converts my list to a pandas dataframe, there are two columns called 'categories' and 'buyers' which are still a list of dictionaries. I'm not sure how to convert these columns to columns where key name is the column name and value is in the rows. My end result would look something like this:</p>
  
  <pre><code>____product_id____toy_id____sales____buyer_id____buyer_age
  
  ________1_________x1_______50_______y1__________22____
  ________1_________x2_______50_______y2__________31____
  </code></pre>
  
  <p>Here's the code I've tried (I'm trying to convert my earlier into a dataframe again, thinking maybe it will break down the dictionary):</p>
  
  <pre><code>list_pd_2 = pd.DataFrame(list_pd)
  </code></pre>
  
  <p>Can anyone help?</p>