<p dir="auto">This works:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="df = pd.DataFrame({'A': [1, 2, 1, 2, 1, 2, 3], 'B': [1, 1, 1, 2, 2, 2, 2]})
df.groupby('B').agg(pd.Series.mode)"><pre class="notranslate"><code class="notranslate">df = pd.DataFrame({'A': [1, 2, 1, 2, 1, 2, 3], 'B': [1, 1, 1, 2, 2, 2, 2]})
df.groupby('B').agg(pd.Series.mode)
</code></pre></div>
<p dir="auto">but this doesn't:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="df.groupby('B').agg('mode')

...
AttributeError: Cannot access callable attribute 'mode' of 'DataFrameGroupBy' objects, try using the 'apply' method"><pre class="notranslate"><code class="notranslate">df.groupby('B').agg('mode')

...
AttributeError: Cannot access callable attribute 'mode' of 'DataFrameGroupBy' objects, try using the 'apply' method
</code></pre></div>
<p dir="auto">I thought all the series aggregate methods propagated automatically to groupby, but I've probably misunderstood?</p>
<h4 dir="auto">Feature Request</h4>
<p dir="auto">Hi,</p>
<p dir="auto">I use pandas a lot in my projects and I got stack with a problem of running the "mode" function (most common element) on a huge groupby object. There are few solutions available using aggregate and  scipy.stats.mode, but they are unbearably slow in comparison to e.g. groupby.mean(). Thus, I would like to make a feature request to add cytonized version of  groupby.mode() operator.</p>
<p dir="auto">Thanks in advance!</p>
<p dir="auto">Jan Musial</p>