title: pandas: split string, and count values?
body: <p>I've got a pandas dataset with a column that's a comma-separated string, e.g. <code>1,2,3,10</code>:</p>
  
  <pre><code>data = [
    { 'id': 1, 'score': 9, 'topics': '11,22,30' },
    { 'id': 2, 'score': 7, 'topics': '11,18,30' },
    { 'id': 3, 'score': 6, 'topics': '1,12,30' },
    { 'id': 4, 'score': 4, 'topics': '1,18,30' }
  ]
  df = pd.DataFrame(data)
  </code></pre>
  
  <p>I'd like to get a count and a mean score for each value in <code>topics</code>. So:</p>
  
  <pre><code>topic_id,count,mean
  1,2,5
  11,2,8
  12,1,6
  </code></pre>
  
  <p>et cetera. How can I do this?</p>
  
  <p>I've got as far as:</p>
  
  <pre><code>df['topic_ids'] = df.topics.str.split()
  </code></pre>
  
  <p>But now I guess I want to explode <code>topic_ids</code> out, so there's a column for each unique value in the entire set of values...?</p>