-
-
Notifications
You must be signed in to change notification settings - Fork 18k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BUG: SparseFrameAccessor.to_dense ignores _constructor #59913
Labels
Comments
janezd
added
Bug
Needs Triage
Issue that has not been reviewed by a pandas team member
labels
Sep 28, 2024
janezd
added a commit
to janezd/orange3
that referenced
this issue
Sep 28, 2024
This is a proper solution that would work before and would continue to work in pandas>=3 -- if it was not for a bug in pandas (pandas-dev/pandas#59913). Hence, this commit also (dynamically) patches the bug in pandas.
janezd
changed the title
BUG:
BUG: SparseFrameAccessor.to_dense ignores _constructor
Sep 28, 2024
SparseFrameAccessor.to_dense
ignores _constructor
janezd
added a commit
to janezd/orange3
that referenced
this issue
Sep 28, 2024
This is a proper solution that would work before and would continue to work in pandas>=3 -- if it was not for a bug in pandas (pandas-dev/pandas#59913). Hence, this commit also (dynamically) patches the bug in pandas.
rhshadrach
added
Subclassing
Subclassing pandas objects
Sparse
Sparse Data Type
and removed
Needs Triage
Issue that has not been reviewed by a pandas team member
labels
Sep 29, 2024
Thanks for the report! PRs to fix are welcome.
pandas fully supports subclassing; I would say it's only discouraged in that other solutions such as composition should be explored and only when those are found to be insufficient should subclassing be considered. Perhaps this is what you mean too. |
janezd
added a commit
to janezd/orange3
that referenced
this issue
Oct 3, 2024
This is a proper solution that would work before and would continue to work in pandas>=3 -- if it was not for a bug in pandas (pandas-dev/pandas#59913). Hence, this commit also (dynamically) patches the bug in pandas.
This was referenced Oct 4, 2024
janezd
added a commit
to janezd/orange3
that referenced
this issue
Oct 4, 2024
This is a proper solution that would work before and would continue to work in pandas>=3 -- if it was not for a bug in pandas (pandas-dev/pandas#59913). Hence, this commit also (dynamically) patches the bug in pandas.
janezd
added a commit
to janezd/orange3
that referenced
this issue
Oct 4, 2024
This is a proper solution that would work before and would continue to work in pandas>=3 -- if it was not for a bug in pandas (pandas-dev/pandas#59913). Hence, this commit also (dynamically) patches the bug in pandas.
janezd
added a commit
to janezd/orange3
that referenced
this issue
Oct 6, 2024
This is a proper solution that would work before and would continue to work in pandas>=3 -- if it was not for a bug in pandas (pandas-dev/pandas#59913). Hence, this commit also (dynamically) patches the bug in pandas.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Pandas version checks
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
Issue Description
to_dense
ignores_constructor
and always returnsDataFrame
.I think the code should look like this:
We use(d) an ugly workaround, but it will stop working in Pandas 3 because of #58733. See our temporary solution in biolab/orange3@98c48e1. :(
Expected Behavior
When subclassing
DataFrame
(which, I know, is discouraged, but sometimes difficult to avoid),to_dense
should observe the constructor returned by_constructor
.Installed Versions
INSTALLED VERSIONS
commit : 23c497b
python : 3.11.10
python-bits : 64
OS : Darwin
OS-release : 23.6.0
Version : Darwin Kernel Version 23.6.0: Mon Jul 29 21:14:30 PDT 2024; root:xnu-10063.141.2~1/RELEASE_ARM64_T6000
machine : arm64
processor : arm
byteorder : little
LC_ALL : None
LANG : en_GB.UTF-8
LOCALE : en_GB.UTF-8
pandas : 3.0.0.dev0+1524.g23c497bb2f
numpy : 1.26.4
dateutil : 2.9.0.post0
pip : 24.2
Cython : 3.0.11
sphinx : 4.5.0
IPython : 8.27.0
adbc-driver-postgresql: None
adbc-driver-sqlite : None
bs4 : 4.13.0b2
blosc : None
bottleneck : 1.4.0
fastparquet : None
fsspec : None
html5lib : 1.1
hypothesis : None
gcsfs : None
jinja2 : 3.1.4
lxml.etree : 5.3.0
matplotlib : 3.9.2
numba : None
numexpr : None
odfpy : None
openpyxl : 3.1.5
psycopg2 : None
pymysql : None
pyarrow : None
pyreadstat : None
pytest : 8.3.3
python-calamine : None
pytz : 2024.2
pyxlsb : None
s3fs : None
scipy : 1.15.0.dev0+git20240926.4c936c8
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : 2.0.1
xlsxwriter : 3.2.0
zstandard : None
tzdata : 2024.1
qtpy : 2.4.1
pyqt5 : None
The text was updated successfully, but these errors were encountered: