<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 [1]: from pandas import Series, DataFrame

In [2]: class SubclassedSeries(Series):
   ...: 
   ...:     @property
   ...:     def _constructor(self):
   ...:         return SubclassedSeries
   ...: 
   ...:     @property
   ...:     def _constructor_expanddim(self):
   ...:         return SubclassedDataFrame
   ...: 
   ...: class SubclassedDataFrame(DataFrame):
   ...: 
   ...:     @property
   ...:     def _constructor(self):
   ...:         return SubclassedDataFrame
   ...: 
   ...:     @property
   ...:     def _constructor_sliced(self):
   ...:         return SubclassedSeries
   ...: 

In [3]: sdf = SubclassedDataFrame({&quot;A&quot;: [0, 1, 2], &quot;B&quot;: [0, 1, 2]})

In [4]: sdf.stack()
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
&lt;ipython-input-4-987edeff1e47&gt; in &lt;module&gt;()
----&gt; 1 sdf.stack()

~/Software/miniconda3/envs/pandas_stack/lib/python3.6/site-packages/pandas/core/frame.py in stack(self, level, dropna)
   4506             return stack_multiple(self, level, dropna=dropna)
   4507         else:
-&gt; 4508             return stack(self, level, dropna=dropna)
   4509 
   4510     def unstack(self, level=-1, fill_value=None):

~/Software/miniconda3/envs/pandas_stack/lib/python3.6/site-packages/pandas/core/reshape/reshape.py in stack(frame, level, dropna)
    545 
    546     klass = type(frame)._constructor_sliced
--&gt; 547     return klass(new_values, index=new_index)
    548 
    549 

TypeError: 'property' object is not callable
"><pre class="notranslate"><span class="pl-v">In</span> [<span class="pl-c1">1</span>]: <span class="pl-s1">from</span> <span class="pl-s1">pandas</span> <span class="pl-k">import</span> <span class="pl-v">Series</span>, <span class="pl-v">DataFrame</span>

<span class="pl-v">In</span> [<span class="pl-c1">2</span>]: <span class="pl-s1">class</span> <span class="pl-v">SubclassedSeries</span>(<span class="pl-v">Series</span>):
   ...: 
   ...:     @<span class="pl-s1">property</span>
   ...:     <span class="pl-k">def</span> <span class="pl-en">_constructor</span>(<span class="pl-s1">self</span>):
   ...:         <span class="pl-k">return</span> <span class="pl-v">SubclassedSeries</span>
   ...: 
   ...:     @<span class="pl-s1">property</span>
   ...:     <span class="pl-k">def</span> <span class="pl-en">_constructor_expanddim</span>(<span class="pl-s1">self</span>):
   ...:         <span class="pl-k">return</span> <span class="pl-v">SubclassedDataFrame</span>
   ...: 
   ...: <span class="pl-k">class</span> <span class="pl-v">SubclassedDataFrame</span>(<span class="pl-v">DataFrame</span>):
   ...: 
   ...:     @<span class="pl-s1">property</span>
   ...:     <span class="pl-k">def</span> <span class="pl-en">_constructor</span>(<span class="pl-s1">self</span>):
   ...:         <span class="pl-k">return</span> <span class="pl-v">SubclassedDataFrame</span>
   ...: 
   ...:     @<span class="pl-s1">property</span>
   ...:     <span class="pl-k">def</span> <span class="pl-en">_constructor_sliced</span>(<span class="pl-s1">self</span>):
   ...:         <span class="pl-k">return</span> <span class="pl-v">SubclassedSeries</span>
   ...: 

<span class="pl-v">In</span> [<span class="pl-c1">3</span>]: <span class="pl-s1">sdf</span> <span class="pl-c1">=</span> <span class="pl-v">SubclassedDataFrame</span>({<span class="pl-s">"A"</span>: [<span class="pl-c1">0</span>, <span class="pl-c1">1</span>, <span class="pl-c1">2</span>], <span class="pl-s">"B"</span>: [<span class="pl-c1">0</span>, <span class="pl-c1">1</span>, <span class="pl-c1">2</span>]})

<span class="pl-v">In</span> [<span class="pl-c1">4</span>]: <span class="pl-s1">sdf</span>.<span class="pl-en">stack</span>()
<span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span>
<span class="pl-v">TypeError</span>                                 <span class="pl-v">Traceback</span> (<span class="pl-s1">most</span> <span class="pl-s1">recent</span> <span class="pl-s1">call</span> <span class="pl-s1">last</span>)
<span class="pl-c1">&lt;</span><span class="pl-s1">ipython</span><span class="pl-c1">-</span><span class="pl-s1">input</span><span class="pl-c1">-</span><span class="pl-c1">4</span><span class="pl-c1">-</span><span class="pl-c1">987</span><span class="pl-s1">edeff1e47</span><span class="pl-c1">&gt;</span> <span class="pl-s1">in</span> <span class="pl-c1">&lt;</span><span class="pl-s1">module</span><span class="pl-c1">&gt;</span>()
<span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">&gt;</span> <span class="pl-c1">1</span> <span class="pl-s1">sdf</span>.<span class="pl-en">stack</span>()

<span class="pl-c1">~</span><span class="pl-c1">/</span><span class="pl-v">Software</span><span class="pl-c1">/</span><span class="pl-s1">miniconda3</span><span class="pl-c1">/</span><span class="pl-s1">envs</span><span class="pl-c1">/</span><span class="pl-s1">pandas_stack</span><span class="pl-c1">/</span><span class="pl-s1">lib</span><span class="pl-c1">/</span><span class="pl-s1">python3</span>.<span class="pl-c1">6</span><span class="pl-c1">/</span><span class="pl-s1">site</span><span class="pl-c1">-</span><span class="pl-s1">packages</span><span class="pl-c1">/</span><span class="pl-s1">pandas</span><span class="pl-c1">/</span><span class="pl-s1">core</span><span class="pl-c1">/</span><span class="pl-s1">frame</span>.<span class="pl-s1">py</span> <span class="pl-c1">in</span> <span class="pl-en">stack</span>(<span class="pl-s1">self</span>, <span class="pl-s1">level</span>, <span class="pl-s1">dropna</span>)
   <span class="pl-c1">4506</span>             <span class="pl-k">return</span> <span class="pl-en">stack_multiple</span>(<span class="pl-s1">self</span>, <span class="pl-s1">level</span>, <span class="pl-s1">dropna</span><span class="pl-c1">=</span><span class="pl-s1">dropna</span>)
   <span class="pl-c1">4507</span>         <span class="pl-s1">else</span>:
<span class="pl-c1">-</span><span class="pl-c1">&gt;</span> <span class="pl-c1">4508</span>             <span class="pl-s1">return</span> <span class="pl-en">stack</span>(<span class="pl-s1">self</span>, <span class="pl-s1">level</span>, <span class="pl-s1">dropna</span><span class="pl-c1">=</span><span class="pl-s1">dropna</span>)
   <span class="pl-c1">4509</span> 
   <span class="pl-c1">4510</span>     <span class="pl-k">def</span> <span class="pl-en">unstack</span>(<span class="pl-s1">self</span>, <span class="pl-s1">level</span><span class="pl-c1">=</span><span class="pl-c1">-</span><span class="pl-c1">1</span>, <span class="pl-s1">fill_value</span><span class="pl-c1">=</span><span class="pl-c1">None</span>):

<span class="pl-c1">~</span><span class="pl-c1">/</span><span class="pl-v">Software</span><span class="pl-c1">/</span><span class="pl-s1">miniconda3</span><span class="pl-c1">/</span><span class="pl-s1">envs</span><span class="pl-c1">/</span><span class="pl-s1">pandas_stack</span><span class="pl-c1">/</span><span class="pl-s1">lib</span><span class="pl-c1">/</span><span class="pl-s1">python3</span>.<span class="pl-c1">6</span><span class="pl-c1">/</span><span class="pl-s1">site</span><span class="pl-c1">-</span><span class="pl-s1">packages</span><span class="pl-c1">/</span><span class="pl-s1">pandas</span><span class="pl-c1">/</span><span class="pl-s1">core</span><span class="pl-c1">/</span><span class="pl-s1">reshape</span><span class="pl-c1">/</span><span class="pl-s1">reshape</span>.<span class="pl-s1">py</span> <span class="pl-c1">in</span> <span class="pl-en">stack</span>(<span class="pl-s1">frame</span>, <span class="pl-s1">level</span>, <span class="pl-s1">dropna</span>)
    <span class="pl-c1">545</span> 
    <span class="pl-c1">546</span>     <span class="pl-s1">klass</span> <span class="pl-c1">=</span> <span class="pl-en">type</span>(<span class="pl-s1">frame</span>).<span class="pl-s1">_constructor_sliced</span>
<span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">&gt;</span> <span class="pl-c1">547</span>     <span class="pl-s1">return</span> <span class="pl-en">klass</span>(<span class="pl-s1">new_values</span>, <span class="pl-s1">index</span><span class="pl-c1">=</span><span class="pl-s1">new_index</span>)
    <span class="pl-c1">548</span> 
    <span class="pl-c1">549</span> 

<span class="pl-v">TypeError</span>: <span class="pl-s">'property'</span> <span class="pl-s1">object</span> <span class="pl-c1">is</span> <span class="pl-c1">not</span> <span class="pl-s1">callable</span></pre></div>
<h4 dir="auto">Problem description</h4>
<p dir="auto">When using <code class="notranslate">stack()</code> on a DataFrame into a Series, the code incorrectly references the class rather than the instance.  This works for DataFrame as <code class="notranslate">_constructor_sliced</code> is on the class, but using the paradigm defined <a href="https://pandas.pydata.org/pandas-docs/stable/internals.html" rel="nofollow">here</a> it does not work.  Should be as simple as changing 546 to <code class="notranslate">klass = frame._constructor_sliced</code>.  Seems like this was worked on in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="213556507" data-permission-text="Title is private" data-url="https://github.com/pandas-dev/pandas/issues/15655" data-hovercard-type="pull_request" data-hovercard-url="/pandas-dev/pandas/pull/15655/hovercard" href="https://github.com/pandas-dev/pandas/pull/15655">#15655</a> and reported in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="211842337" data-permission-text="Title is private" data-url="https://github.com/pandas-dev/pandas/issues/15563" data-hovercard-type="issue" data-hovercard-url="/pandas-dev/pandas/issues/15563/hovercard" href="https://github.com/pandas-dev/pandas/issues/15563">#15563</a> but I don't see an associated commit.  What's the status <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/delgadom/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/delgadom">@delgadom</a>?</p>
<h4 dir="auto">Expected Output</h4>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="In [5]: sdf = SubclassedDataFrame({&quot;A&quot;: [0, 1, 2], &quot;B&quot;: [0, 1, 2]})

In [6]: sdf.stack()
Out[6]: 
0  A    0
   B    0
1  A    1
   B    1
2  A    2
   B    2
dtype: int64"><pre class="notranslate"><span class="pl-v">In</span> [<span class="pl-c1">5</span>]: <span class="pl-s1">sdf</span> <span class="pl-c1">=</span> <span class="pl-v">SubclassedDataFrame</span>({<span class="pl-s">"A"</span>: [<span class="pl-c1">0</span>, <span class="pl-c1">1</span>, <span class="pl-c1">2</span>], <span class="pl-s">"B"</span>: [<span class="pl-c1">0</span>, <span class="pl-c1">1</span>, <span class="pl-c1">2</span>]})

<span class="pl-v">In</span> [<span class="pl-c1">6</span>]: <span class="pl-s1">sdf</span>.<span class="pl-en">stack</span>()
<span class="pl-v">Out</span>[<span class="pl-c1">6</span>]: 
<span class="pl-c1">0</span>  <span class="pl-v">A</span>    <span class="pl-c1">0</span>
   <span class="pl-v">B</span>    <span class="pl-c1">0</span>
<span class="pl-c1">1</span>  <span class="pl-v">A</span>    <span class="pl-c1">1</span>
   <span class="pl-v">B</span>    <span class="pl-c1">1</span>
<span class="pl-c1">2</span>  <span class="pl-v">A</span>    <span class="pl-c1">2</span>
   <span class="pl-v">B</span>    <span class="pl-c1">2</span>
<span class="pl-s1">dtype</span>: <span class="pl-s1">int64</span></pre></div>
<h4 dir="auto">Output of <code class="notranslate">pd.show_versions()</code></h4>
<details>
<h2 dir="auto">[paste the output of <code class="notranslate">pd.show_versions()</code> here below this line]<br>
INSTALLED VERSIONS</h2>
<p dir="auto">commit: None<br>
python: 3.6.2.final.0<br>
python-bits: 64<br>
OS: Linux<br>
OS-release: 3.16.0-38-generic<br>
machine: x86_64<br>
processor: x86_64<br>
byteorder: little<br>
LC_ALL: None<br>
LANG: en_US.UTF-8<br>
LOCALE: en_US.UTF-8</p>
<p dir="auto">pandas: 0.21.1<br>
pytest: None<br>
pip: 9.0.1<br>
setuptools: 36.4.0<br>
Cython: None<br>
numpy: 1.13.1<br>
scipy: None<br>
pyarrow: None<br>
xarray: None<br>
IPython: 6.1.0<br>
sphinx: None<br>
patsy: None<br>
dateutil: 2.6.1<br>
pytz: 2017.2<br>
blosc: None<br>
bottleneck: None<br>
tables: None<br>
numexpr: None<br>
feather: None<br>
matplotlib: None<br>
openpyxl: None<br>
xlrd: None<br>
xlwt: None<br>
xlsxwriter: None<br>
lxml: None<br>
bs4: None<br>
html5lib: None<br>
sqlalchemy: None<br>
pymysql: None<br>
psycopg2: None<br>
jinja2: None<br>
s3fs: None<br>
fastparquet: None<br>
pandas_gbq: None<br>
pandas_datareader: None</p>
</details>
<p dir="auto">Subclassed Series and DataFrames with custom <code class="notranslate">_constructor</code>, <code class="notranslate">_constructor_sliced</code>, and <code class="notranslate">_constructor_expanddim</code> methods return pandas Series and DataFrame objects on reshape operations:</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="&gt;&gt;&gt; import numpy as np, pandas as pd
&gt;&gt;&gt; import pandas.util.testing as tm
&gt;&gt;&gt; df = tm.SubclassedDataFrame(np.random.random((4,5)))
&gt;&gt;&gt; df
          0         1         2         3         4
0  0.151944  0.948561  0.639122  0.718071  0.296193
1  0.004606  0.978378  0.827614  0.479320  0.495945
2  0.158874  0.535476  0.173194  0.065292  0.365851
3  0.772392  0.105038  0.671064  0.164165  0.795803
&gt;&gt;&gt; type(df)
&lt;class 'pandas.util.testing.SubclassedDataFrame'&gt;"><pre class="notranslate"><span class="pl-c1">&gt;&gt;</span><span class="pl-c1">&gt;</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">pandas</span> <span class="pl-k">as</span> <span class="pl-s1">pd</span>
<span class="pl-c1">&gt;&gt;</span><span class="pl-c1">&gt;</span> <span class="pl-k">import</span> <span class="pl-s1">pandas</span>.<span class="pl-s1">util</span>.<span class="pl-s1">testing</span> <span class="pl-k">as</span> <span class="pl-s1">tm</span>
<span class="pl-c1">&gt;&gt;</span><span class="pl-c1">&gt;</span> <span class="pl-s1">df</span> <span class="pl-c1">=</span> <span class="pl-s1">tm</span>.<span class="pl-v">SubclassedDataFrame</span>(<span class="pl-s1">np</span>.<span class="pl-s1">random</span>.<span class="pl-en">random</span>((<span class="pl-c1">4</span>,<span class="pl-c1">5</span>)))
<span class="pl-c1">&gt;&gt;</span><span class="pl-c1">&gt;</span> <span class="pl-s1">df</span>
          <span class="pl-c1">0</span>         <span class="pl-c1">1</span>         <span class="pl-c1">2</span>         <span class="pl-c1">3</span>         <span class="pl-c1">4</span>
<span class="pl-c1">0</span>  <span class="pl-c1">0.151944</span>  <span class="pl-c1">0.948561</span>  <span class="pl-c1">0.639122</span>  <span class="pl-c1">0.718071</span>  <span class="pl-c1">0.296193</span>
<span class="pl-c1">1</span>  <span class="pl-c1">0.004606</span>  <span class="pl-c1">0.978378</span>  <span class="pl-c1">0.827614</span>  <span class="pl-c1">0.479320</span>  <span class="pl-c1">0.495945</span>
<span class="pl-c1">2</span>  <span class="pl-c1">0.158874</span>  <span class="pl-c1">0.535476</span>  <span class="pl-c1">0.173194</span>  <span class="pl-c1">0.065292</span>  <span class="pl-c1">0.365851</span>
<span class="pl-c1">3</span>  <span class="pl-c1">0.772392</span>  <span class="pl-c1">0.105038</span>  <span class="pl-c1">0.671064</span>  <span class="pl-c1">0.164165</span>  <span class="pl-c1">0.795803</span>
<span class="pl-c1">&gt;&gt;</span><span class="pl-c1">&gt;</span> <span class="pl-en">type</span>(<span class="pl-s1">df</span>)
<span class="pl-c1">&lt;</span><span class="pl-k">class</span> <span class="pl-s">'pandas.util.testing.SubclassedDataFrame'</span><span class="pl-c1">&gt;</span></pre></div>
<p dir="auto">Slicing operations use <code class="notranslate">_constructor_sliced</code>:</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="&gt;&gt;&gt; type(df[0])
&lt;class 'pandas.util.testing.SubclassedSeries'&gt;"><pre class="notranslate"><span class="pl-c1">&gt;&gt;</span><span class="pl-c1">&gt;</span> <span class="pl-en">type</span>(<span class="pl-s1">df</span>[<span class="pl-c1">0</span>])
<span class="pl-c1">&lt;</span><span class="pl-k">class</span> <span class="pl-s">'pandas.util.testing.SubclassedSeries'</span><span class="pl-c1">&gt;</span></pre></div>
<p dir="auto">Reshape operations return regular pandas objects:</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="&gt;&gt;&gt; type(df.stack())
&lt;class 'pandas.core.series.Series'&gt;"><pre class="notranslate"><span class="pl-c1">&gt;&gt;</span><span class="pl-c1">&gt;</span> <span class="pl-en">type</span>(<span class="pl-s1">df</span>.<span class="pl-en">stack</span>())
<span class="pl-c1">&lt;</span><span class="pl-k">class</span> <span class="pl-s">'pandas.core.series.Series'</span><span class="pl-c1">&gt;</span></pre></div>
<p dir="auto">It would be great if this returned a <code class="notranslate">SublcassedSeries</code>. Same goes for unstack and pivot.</p>