stack() does not work with subclassed DataFrame #18859
Labels
Compat
pandas objects compatability with Numpy or Python functions
Duplicate Report
Duplicate issue or pull request
Reshaping
Concat, Merge/Join, Stack/Unstack, Explode
Subclassing
Subclassing pandas objects
Code Sample, a copy-pastable example if possible
Problem description
When using
stack()
on a DataFrame into a Series, the code incorrectly references the class rather than the instance. This works for DataFrame as_constructor_sliced
is on the class, but using the paradigm defined here it does not work. Should be as simple as changing 546 toklass = frame._constructor_sliced
. Seems like this was worked on in #15655 and reported in #15563 but I don't see an associated commit. What's the status @delgadom?Expected Output
Output of
pd.show_versions()
[paste the output of
pd.show_versions()
here below this line]INSTALLED VERSIONS
commit: None
python: 3.6.2.final.0
python-bits: 64
OS: Linux
OS-release: 3.16.0-38-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: en_US.UTF-8
pandas: 0.21.1
pytest: None
pip: 9.0.1
setuptools: 36.4.0
Cython: None
numpy: 1.13.1
scipy: None
pyarrow: None
xarray: None
IPython: 6.1.0
sphinx: None
patsy: None
dateutil: 2.6.1
pytz: 2017.2
blosc: None
bottleneck: None
tables: None
numexpr: None
feather: None
matplotlib: None
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: None
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: None
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None
The text was updated successfully, but these errors were encountered: