<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="import pandas as pd
import numpy as np

ts1 = np.datetime64('2017-11-29T03:30')
ts2 = np.datetime64('2017-11-29T03:45')
d = {'number' : pd.Series([1., 2.]), 'string': pd.Series(['haha', 'wawa']), 'datetime64': pd.Series([ts1, ts2])}
df = pd.DataFrame(d)
df.apply(lambda row: (row.number, row.string), axis=1)"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-s1">pandas</span> <span class="pl-k">as</span> <span class="pl-s1">pd</span>
<span class="pl-k">import</span> <span class="pl-s1">numpy</span> <span class="pl-k">as</span> <span class="pl-s1">np</span>

<span class="pl-s1">ts1</span> <span class="pl-c1">=</span> <span class="pl-s1">np</span>.<span class="pl-en">datetime64</span>(<span class="pl-s">'2017-11-29T03:30'</span>)
<span class="pl-s1">ts2</span> <span class="pl-c1">=</span> <span class="pl-s1">np</span>.<span class="pl-en">datetime64</span>(<span class="pl-s">'2017-11-29T03:45'</span>)
<span class="pl-s1">d</span> <span class="pl-c1">=</span> {<span class="pl-s">'number'</span> : <span class="pl-s1">pd</span>.<span class="pl-v">Series</span>([<span class="pl-c1">1.</span>, <span class="pl-c1">2.</span>]), <span class="pl-s">'string'</span>: <span class="pl-s1">pd</span>.<span class="pl-v">Series</span>([<span class="pl-s">'haha'</span>, <span class="pl-s">'wawa'</span>]), <span class="pl-s">'datetime64'</span>: <span class="pl-s1">pd</span>.<span class="pl-v">Series</span>([<span class="pl-s1">ts1</span>, <span class="pl-s1">ts2</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-s1">d</span>)
<span class="pl-s1">df</span>.<span class="pl-en">apply</span>(<span class="pl-k">lambda</span> <span class="pl-s1">row</span>: (<span class="pl-s1">row</span>.<span class="pl-s1">number</span>, <span class="pl-s1">row</span>.<span class="pl-s1">string</span>), <span class="pl-s1">axis</span><span class="pl-c1">=</span><span class="pl-c1">1</span>)</pre></div>
<h4 dir="auto">Problem description</h4>
<p dir="auto">Applying lambda function to a DataFrame with columns of type numpy.datetime64 throws an unexpected error: <code class="notranslate">ValueError: Shape of passed values is (2, 2), indices imply (2, 3)</code>. The error message is not helpful, and I believe this error is thrown due to a bug. Dropping columns of type numpy.datetime64 fixes the issue.</p>
<h4 dir="auto">Expected Output</h4>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="0    (1.0, haha)
1    (2.0, wawa)
dtype: object"><pre class="notranslate"><code class="notranslate">0    (1.0, haha)
1    (2.0, wawa)
dtype: object
</code></pre></div>
<h4 dir="auto">Output of <code class="notranslate">pd.show_versions()</code></h4>
<details>
<h2 dir="auto">INSTALLED VERSIONS</h2>
<p dir="auto">commit: None<br>
python: 2.7.14.final.0<br>
python-bits: 64<br>
OS: Darwin<br>
OS-release: 16.7.0<br>
machine: x86_64<br>
processor: i386<br>
byteorder: little<br>
LC_ALL: None<br>
LANG: en_US.UTF-8<br>
LOCALE: None.None</p>
<p dir="auto">pandas: 0.20.3<br>
pytest: 3.2.1<br>
pip: 9.0.1<br>
setuptools: 36.5.0.post20170921<br>
Cython: 0.26.1<br>
numpy: 1.13.3<br>
scipy: 0.19.1<br>
xarray: None<br>
IPython: 5.4.1<br>
sphinx: 1.6.3<br>
patsy: 0.4.1<br>
dateutil: 2.6.1<br>
pytz: 2017.2<br>
blosc: None<br>
bottleneck: 1.2.1<br>
tables: 3.4.2<br>
numexpr: 2.6.2<br>
feather: None<br>
matplotlib: 2.1.0<br>
openpyxl: 2.4.8<br>
xlrd: 1.1.0<br>
xlwt: 1.2.0<br>
xlsxwriter: 1.0.2<br>
lxml: 4.1.0<br>
bs4: 4.6.0<br>
html5lib: 0.999999999<br>
sqlalchemy: 1.1.13<br>
pymysql: None<br>
psycopg2: None<br>
jinja2: 2.9.6<br>
s3fs: None<br>
pandas_gbq: None<br>
pandas_datareader: None</p>
</details>
<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="pd.DataFrame({'col_1':['val_1','val_2','val_3']}).apply(lambda row: [1], axis=1, reduce=True)"><pre class="notranslate"><span class="pl-s1">pd</span>.<span class="pl-v">DataFrame</span>({<span class="pl-s">'col_1'</span>:[<span class="pl-s">'val_1'</span>,<span class="pl-s">'val_2'</span>,<span class="pl-s">'val_3'</span>]}).<span class="pl-en">apply</span>(<span class="pl-k">lambda</span> <span class="pl-s1">row</span>: [<span class="pl-c1">1</span>], <span class="pl-s1">axis</span><span class="pl-c1">=</span><span class="pl-c1">1</span>, <span class="pl-s1">reduce</span><span class="pl-c1">=</span><span class="pl-c1">True</span>)</pre></div>
<h4 dir="auto">Problem description</h4>
<p dir="auto">Per the documentation, calling Dataframe.apply w/ reduce=True should always produce a Series.  However, if the applied function returns list values Dataframe.apply returns a Dataframe, not a Series.</p>
<h4 dir="auto">Expected Output</h4>
<p dir="auto">When called with reduce=True, I expect Dataframe.apply to produce a Series where each element is a list, not a Dataframe.</p>
<h4 dir="auto">Output of <code class="notranslate">pd.show_versions()</code></h4>
<p dir="auto">0.18.1</p>