title: value_counts not working in groupby apply
body: <p>I am using <code>.apply(pd.Series.value_counts, axis=0)</code> to count the values in two pandas columns ['a','b'].</p>
  <p>However when I try and use it <strong>after grouping</strong> on column 'Group', I get the error:</p>
  <pre class="lang-py prettyprint-override"><code>TypeError: value_counts() got an unexpected keyword argument 'axis'
  </code></pre>
  <p>It works when grouping in a <strong>for loop</strong>, but not with a <strong>groupby apply</strong>.</p>
  <p>Here is code with a working groupby in for loop, and with the groupby.apply not working:</p>
  <pre class="lang-py prettyprint-override"><code>import pandas as pd
  import numpy as np
  
   #example dataframe 
  df = pd.DataFrame(
      {
          &quot;a&quot;: [1, 1, 2, 3, 3, 4, 5, 1, 1, 1, 4, 4, 4, 5, 6, 6, 6, 6, 3],
          'b': [3, 4, 5, 5, 5, 2, 1, 3, 4, 4, 4, 5, 6, 6, 4, 3, 6, 6, 3],
          &quot;Group&quot;: ['g1', 'g1', 'g1', 'g2', 'g2', 'g1', 'g2', 'g1', 'g1', 'g2','g2', 'g2', 'g2', 'g2', 'g1','g1', 'g2', 'g2', 'g2'],
      }
  )
  
  
   #grouping and applying with for loop. 
  lst = []
  for key, grp in df.groupby('Group'): 
    df_ = grp[['a','b']].apply(pd.Series.value_counts, axis=0)
    df_['Group']=key
    lst.append(df_)
  print ('this works', pd.concat(lst), sep='\n')
  
   # with df.groupby it doesn't work. 
  df.groupby('Group')[['a','b']].apply(pd.Series.value_counts,  axis=0)
  </code></pre>
  <p>OUTPUT, with the expected result from the for loop</p>
  <pre class="lang-py prettyprint-override"><code>     a    b Group
  1  4.0  NaN    g1
  2  1.0  1.0    g1
  3  NaN  3.0    g1
  4  1.0  3.0    g1
  5  NaN  1.0    g1
  6  2.0  NaN    g1
  1  1.0  1.0    g2
  3  3.0  1.0    g2
  4  3.0  2.0    g2
  5  2.0  3.0    g2
  6  2.0  4.0    g2
  
  ---------------------------------------------------------------------------
  TypeError                                 Traceback (most recent call last)
  /usr/local/lib/python3.7/dist-packages/pandas/core/groupby/groupby.py in apply(self, func, *args, **kwargs)
     1274             try:
  -&gt; 1275                 result = self._python_apply_general(f, self._selected_obj)
     1276             except TypeError:
  
  11 frames
  TypeError: value_counts() got an unexpected keyword argument 'axis'
  
  During handling of the above exception, another exception occurred:
  
  TypeError                                 Traceback (most recent call last)
  /usr/local/lib/python3.7/dist-packages/pandas/core/groupby/groupby.py in f(g)
     1257                 def f(g):
     1258                     with np.errstate(all=&quot;ignore&quot;):
  -&gt; 1259                         return func(g, *args, **kwargs)
     1260 
     1261             elif hasattr(nanops, &quot;nan&quot; + func):
  
  TypeError: value_counts() got an unexpected keyword argument 'axis'
  
  
  </code></pre>