Skip to content

BUG: Make DataFrame not hardcode it's own constructor in the code. Issue #2859 #2865

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

Closed

Conversation

lukauskas
Copy link

BUG: Make DataFrame not hardcode it's own constructor in the code. Issue

Changed all occurrences of return DataFrame to return self._constructor and changed the latter to return self.__class__
rather than DataFrame by default.

Also made static methods like DataFrame.from_dict work on the
cls passed to them rather than on hard-coded DataFrame.

This is a minimal quick win on the cases described in Issue #2859.
A formal approach to make classes friendly to subclassing might still be
needed, see discussion in the case.

Changed all occurrences of `return DataFrame` to `return
self._constructor` and changed the latter to return `self.__class__`
rather than `DataFrame` by default.

Also made static methods like `DataFrame.from_dict` work on the
`cls` passed to them rather than on hard-coded `DataFrame`.

This is a minimal quick win on the cases described in Issue pandas-dev#2859.
A formal approach to make classes friendly to subclassing might still be
needed, see discussion in the case.
@wesm
Copy link
Member

wesm commented Mar 28, 2013

Quick "hand merge". This won't solve the issue but helps in some cases

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants