BUG: pandas 2.1.2 changes how copy
works · Issue #55763 · pandas-dev/pandas (original) (raw)
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
import pandas as pd
class Sub(pd.DataFrame): pass
assert not isinstance(Sub().copy(), Sub)
Issue Description
Since very long ago, calling .copy()
on a DataFrame subclass returned a DataFrame object. This should be changed in a major release, not a feature release, and definitely not a patch release.
Expected Behavior
The above assert statement to succeed
See also
- Probably related: BUG: Infinite recursion on inheritance and overloading __getattr__ in v2.1.0 #55120
- Downstream bug report: DataFrameView in pandas 2.1.2 changed behavior, breaking AnnData in several ways scverse/anndata#1210
Installed Versions
pandas 2.1.2 or 2.2.0.dev0+447