Skip to content

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