title: How to unpack a parsed yaml output
body: <p>I have parsed a yaml file using code from another post </p>
  
  <pre><code>import pprint
  with open("test.yaml", 'r') as stream:
      pprint.pprint(yaml.load(stream))
  </code></pre>
  
  <p>and I get the output as follows</p>
  
  <pre><code> 'innings': [{'1st innings': {'deliveries': [{0.1: {'batsman': 'SR Watson',
                                                  'bowler': 'JM Anderson',
                                                  'extras': {'wides': 1},
                                                  'non_striker': 'TD Paine',
                                                  'runs': {'batsman': 0,
                                                           'extras': 1,
                                                           'total': 1}}},
                                           {0.2: {'batsman': 'SR Watson',
                                                  'bowler': 'JM Anderson',
                                                  'non_striker': 'TD Paine',
                                                  'runs': {'batsman': 0,
                                                           'extras': 0,
                                                           'total': 0}}},
                                           ...
  </code></pre>
  
  <p>How can I convert the above into a matrix/dataframe? What is the best way to do this?                                          ....</p>
  
  <p>I did use R's yaml.file_load() and then coerced it into a data.frame,followed by a transpose as it had too many columns. The o/p is below</p>
  
  <pre><code> innings.1st.innings.deliveries.2.3.batsman SR Watson   SR Watson
   109    innings.1st.innings.deliveries.2.3.bowler   JM Anderson JM Anderson
   110    innings.1st.innings.deliveries.2.3.non_striker  TD Paine    TD Paine
   111    innings.1st.innings.deliveries.2.3.runs.batsman 2   2
   112    innings.1st.innings.deliveries.2.3.runs.extras  0   0
   113    innings.1st.innings.deliveries.2.3.runs.total   2   2
  </code></pre>
  
  <p>I would like to perform my analysis using R. With R the column
  innings.1st.innings.deliveries.2.3.runs.batsman needs to be parsed with regex and the deliveries needs to got.</p>
  
  <p>Would it make sense to use perl or python and read each line finally output
  something like this for </p>
  
  <pre><code>  Watson vs Anderson
                 Runs
   Over
   1                   4
   2                   3
   3                   6
  
   Watson vs Broad
                     Runs
   Over
   1                   1
   2                   4
   3                   2
  </code></pre>