Open janezd opened 4 days ago
Thanks for the report! PRs to fix are welcome.
When subclassing
DataFrame
(which, I know, is discouraged, but sometimes difficult to avoid)
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.
Pandas version checks
[X] I have checked that this issue has not already been reported.
[X] I have confirmed this bug exists on the latest version of pandas.
[X] 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 https://github.com/biolab/orange3/pull/6897/commits/98c48e1b3b7c705f10af195a395213114dc2a917. :(
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