<h4 dir="auto">Code Sample, a copy-pastable example if possible</h4>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="In [2]: df = pd.DataFrame([[1], [2], [3.3]])

In [3]: df.groupby([1,1,1]).agg(len)
Out[3]: 
     0
1  3.0"><pre class="notranslate"><span class="pl-v">In</span> [<span class="pl-c1">2</span>]: <span class="pl-s1">df</span> <span class="pl-c1">=</span> <span class="pl-s1">pd</span>.<span class="pl-v">DataFrame</span>([[<span class="pl-c1">1</span>], [<span class="pl-c1">2</span>], [<span class="pl-c1">3.3</span>]])

<span class="pl-v">In</span> [<span class="pl-c1">3</span>]: <span class="pl-s1">df</span>.<span class="pl-en">groupby</span>([<span class="pl-c1">1</span>,<span class="pl-c1">1</span>,<span class="pl-c1">1</span>]).<span class="pl-en">agg</span>(<span class="pl-s1">len</span>)
<span class="pl-v">Out</span>[<span class="pl-c1">3</span>]: 
     <span class="pl-c1">0</span>
<span class="pl-c1">1</span>  <span class="pl-c1">3.0</span></pre></div>
<h4 dir="auto">Problem description</h4>
<p dir="auto">The result of <code class="notranslate">len</code> should be <code class="notranslate">int</code>, regardless of the input. This is not specific to <code class="notranslate">len</code>: <code class="notranslate">lambda x : 3</code> results in the same.</p>
<h4 dir="auto">Expected Output</h4>
<p dir="auto">Compare to</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="In [4]: df.apply(len)
Out[4]: 
0    3
dtype: int64

In [5]: df.groupby([1,1,1]).apply(len)
Out[5]: 
1    3
dtype: int64

In [6]: df.astype(int).groupby([1,1,1]).agg(len)
Out[6]: 
   0
1  3
"><pre class="notranslate"><span class="pl-v">In</span> [<span class="pl-c1">4</span>]: <span class="pl-s1">df</span>.<span class="pl-en">apply</span>(<span class="pl-s1">len</span>)
<span class="pl-v">Out</span>[<span class="pl-c1">4</span>]: 
<span class="pl-c1">0</span>    <span class="pl-c1">3</span>
<span class="pl-s1">dtype</span>: <span class="pl-s1">int64</span>

<span class="pl-v">In</span> [<span class="pl-c1">5</span>]: <span class="pl-s1">df</span>.<span class="pl-en">groupby</span>([<span class="pl-c1">1</span>,<span class="pl-c1">1</span>,<span class="pl-c1">1</span>]).<span class="pl-en">apply</span>(<span class="pl-s1">len</span>)
<span class="pl-v">Out</span>[<span class="pl-c1">5</span>]: 
<span class="pl-c1">1</span>    <span class="pl-c1">3</span>
<span class="pl-s1">dtype</span>: <span class="pl-s1">int64</span>

<span class="pl-v">In</span> [<span class="pl-c1">6</span>]: <span class="pl-s1">df</span>.<span class="pl-en">astype</span>(<span class="pl-s1">int</span>).<span class="pl-en">groupby</span>([<span class="pl-c1">1</span>,<span class="pl-c1">1</span>,<span class="pl-c1">1</span>]).<span class="pl-en">agg</span>(<span class="pl-s1">len</span>)
<span class="pl-v">Out</span>[<span class="pl-c1">6</span>]: 
   <span class="pl-c1">0</span>
<span class="pl-c1">1</span>  <span class="pl-c1">3</span></pre></div>
<h4 dir="auto">Output of <code class="notranslate">pd.show_versions()</code></h4>
<details>
INSTALLED VERSIONS
------------------
commit: <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/pandas-dev/pandas/commit/9e7666dae3b3b10d987ce154a51c78bcee6e0728/hovercard" href="https://github.com/pandas-dev/pandas/commit/9e7666dae3b3b10d987ce154a51c78bcee6e0728"><tt>9e7666d</tt></a>
python: 3.5.3.final.0
python-bits: 64
OS: Linux
OS-release: 4.9.0-3-amd64
machine: x86_64
processor: 
byteorder: little
LC_ALL: None
LANG: it_IT.UTF-8
LOCALE: it_IT.UTF-8
<p dir="auto">pandas: 0.21.0.dev+265.g9e7666dae<br>
pytest: 3.0.6<br>
pip: 9.0.1<br>
setuptools: None<br>
Cython: 0.25.2<br>
numpy: 1.12.1<br>
scipy: 0.19.0<br>
xarray: None<br>
IPython: 5.1.0.dev<br>
sphinx: 1.5.6<br>
patsy: 0.4.1<br>
dateutil: 2.6.0<br>
pytz: 2017.2<br>
blosc: None<br>
bottleneck: 1.2.1<br>
tables: 3.3.0<br>
numexpr: 2.6.1<br>
feather: 0.3.1<br>
matplotlib: 2.0.2<br>
openpyxl: None<br>
xlrd: 1.0.0<br>
xlwt: 1.1.2<br>
xlsxwriter: 0.9.6<br>
lxml: None<br>
bs4: 4.5.3<br>
html5lib: 0.999999999<br>
sqlalchemy: 1.0.15<br>
pymysql: None<br>
psycopg2: None<br>
jinja2: 2.9.6<br>
s3fs: None<br>
pandas_gbq: None<br>
pandas_datareader: 0.2.1</p>
</details>
<p dir="auto">gbq.py currently returns an error if the result of a query is what Google considers to be 'Large'.  The google api allows jobs to be sent with a flag to allow large results.  It would be very beneficial to provide this as an option in the BigQuery connector.</p>