You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In [16]: from pandas.tests.frame.test_subclass import MySubclassWithMetadata
In [17]: df = MySubclassWithMetadata.from_records([{'a': 1, 'b': 2}])
In [18]: type(df)
Out[18]: pandas.tests.frame.test_subclass.MySubclassWithMetadata
In [19]: df.my_metadata
...
AttributeError: 'MySubclassWithMetadata' object has no attribute 'my_metadata'
With pandas 2.1.4, this works fine.
The reason for this is because from_records was updated (#52419) to use
instead of cls(mgr) for the final dataframe construction.
I think this should probably at least use _constructor_from_mgr instead of _from_mgr (and maybe even still call the class? because in this case there is not finalize that can be called to finalize the initialization)
The text was updated successfully, but these errors were encountered:
Example
With pandas 2.1.4, this works fine.
The reason for this is because
from_records
was updated (#52419) to usepandas/pandas/core/frame.py
Line 2532 in 5740667
instead of
cls(mgr)
for the final dataframe construction.I think this should probably at least use
_constructor_from_mgr
instead of_from_mgr
(and maybe even still call the class? because in this case there is not finalize that can be called to finalize the initialization)The text was updated successfully, but these errors were encountered: