title: Explanation about pandas value_counts function
body: <p>Can someone please explain what does the line </p>
  
  <pre><code>result = data.apply(pd.value_counts).fillna(0)  
  </code></pre>
  
  <p>does in here?</p>
  
  <pre><code>import pandas as pd 
  from pandas import Series, DataFrame
  
  data = DataFrame({'Qu1': [1, 3, 4, 3, 4],
                    'Qu2': [2, 3, 1, 2, 3],
                    'Qu3': [1, 5, 2, 4, 4]})
  
  result = data.apply(pd.value_counts).fillna(0)  
  
  In [26]:data
  Out[26]:
  Qu1 Qu2 Qu3
  0 1 2 1
  1 3 3 5
  2 4 1 2
  3 3 2 4
  4 4 3 4
  
  In [27]:result
  Out[28]:
  Qu1 Qu2 Qu3
  1 1 1 1
  2 0 2 1
  3 2 2 0
  4 2 0 2
  5 0 0 1
  </code></pre>