We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
# my_dataframe.py import pandas as pd class MySeries(pd.Series): @property def _constructor(self): return MySeries @property def _constructor_expanddim(self): return MyDataFrame class MyDataFrame(pd.DataFrame): def __init__(self, data=None, index=None, columns=None, dtype=None, copy=False, **kwargs): super(MyDataFrame, self).__init__(data=data, index=index, columns=columns, dtype=dtype, copy=copy, **kwargs) @property def _constructor(self): return MyDataFrame @property def _constructor_sliced(self): return MySeries @property def _constructor_expanddim(self): return MyPanel class MyPanel(pd.Panel): def __init__(self, data=None, items=None, major_axis=None, minor_axis=None, copy=False, dtype=None, **kwargs): super(MyPanel, self).__init__(data=data, items=items, major_axis=major_axis, minor_axis=minor_axis, copy=copy, dtype=dtype, **kwargs) @property def _constructor(self): return MyPanel @property def _constructor_sliced(self): return MyDataFrame def f(): df1 = MyDataFrame(pd.DataFrame([1, 2, 3, 4, 5], columns=['A'])) df2 = MyDataFrame(pd.DataFrame([1, 2, 3, 4, 5], columns=['A'])) print type(df1.align(df2, axis=0)[0]) # Note, if aligning with frame, it works fine, returns MyDataFrame print type(df1.align(df2.A, axis=0)[0]) # But if aligning with series, it does not, returns DataFrame # import my_dataframe my_dataframe.f() <class 'com.utils.my_dataframe.MyDataFrame'> # Correct <class 'pandas.core.frame.DataFrame'> # Does not invoke _constructor()
When aligning with a series, the code seems to explicitly create the DataFrame using DataFrame() constructor.
The text was updated successfully, but these errors were encountered:
is this not covered in: #12308 (or several recently merged issues)?
Sorry, something went wrong.
@sinhrks
f6a1c41
Successfully merging a pull request may close this issue.
When aligning with a series, the code seems to explicitly create the DataFrame using DataFrame() constructor.
The text was updated successfully, but these errors were encountered: