title: Iterating over nested Ordered Dictionaries in Python, then Saving keys (or values) to Pandas dataframe
body: <p>I am trying to iterate over nested Ordered Dictionaries in Python. I know that I can do something like this:</p>
  
  <pre><code>food = OrderedDict([('Fruits', OrderedDict([('Apple', 50), ('Banana', 100), ('Pear', 200)])), 
                      ('Vegetables', OrderedDict([('Carrot', 10), ('Broccoli', 5), ('Corn', 40)]))])
  for value in food.itervalues():
      for key in value.iterkeys():
          print key
  </code></pre>
  
  <p>to get the key (or value) using nested for loops. However, how can I do this in one line? I am trying to save only the String keys (i.e. the fruit names) to a pandas dataframe (the numbers are not used). Here was my attempt:</p>
  
  <pre><code>food_df = pd.DataFrame({'Food': key for key in value.iterkeys() for value in food.itervalues()})
  </code></pre>
  
  <p>Which raises the error:</p>
  
  <pre><code>File "C:\Python27\lib\site-packages\pandas\core\frame.py", line 397, in __init__
      mgr = self._init_dict(data, index, columns, dtype=dtype)
  File "C:\Python27\lib\site-packages\pandas\core\frame.py", line 528, in _init_dict
      dtype=dtype)
  File "C:\Python27\lib\site-packages\pandas\core\frame.py", line 5670, in _arrays_to_mgr
      index = extract_index(arrays)
  File "C:\Python27\lib\site-packages\pandas\core\frame.py", line 5708, in extract_index
      raise ValueError('If using all scalar values, you must must pass'
      ValueError: If using all scalar values, you must must pass an index
  </code></pre>
  
  <p>Any ideas? Thanks!</p>