-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
DataFrame.convert_dtypes doesn't preserve subclasses #44249
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
Merged
jreback
merged 16 commits into
pandas-dev:master
from
m-richards:convert_dtypes_subclasses
Nov 13, 2021
Merged
Changes from 12 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
04c6d2b
TST: add test for GH43668
m-richards abc7499
BUG: fix convert_dtypes GH43668
m-richards f3768a5
CLN: linting
m-richards 7aeb38e
TST: update finalize calls test
m-richards 74d7bb8
DOC: add what's new entry
m-richards 05c922d
CLN split line into multiple lines
m-richards 80cc94e
Merge remote-tracking branch 'upstream/master' into convert_dtypes_su…
m-richards 2897822
DOC: fix linebreak in rst
m-richards f875cf3
Merge remote-tracking branch 'upstream/master' into convert_dtypes_su…
m-richards 51897cd
Merge branch 'pandas-dev:master' into convert_dtypes_subclasses
m-richards 7fa2f7e
TST:bad fix to mypy issues
m-richards 89e0032
Merge branch 'convert_dtypes_subclasses' of github.com:m-richards/pan…
m-richards 299d139
TST: mypy fix broke tests
m-richards 7a573e2
CLN: remove print I left in
m-richards 2ba3c54
Merge remote-tracking branch 'upstream/master' into convert_dtypes_su…
m-richards e58cd7b
Merge branch 'pandas-dev:master' into convert_dtypes_subclasses
m-richards File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not super happy with this. Was getting the error
at https://github.com/pandas-dev/pandas/runs/4114882794?check_suite_focus=true, which refers to the line
result = self._constructor(concat(results, axis=1, copy=False))
.Bit confused because
NDFrame._constructor
raises an abstractmethod error, I'm guessing mypy is then reading the parent classPandasObject
which returnstype(self)
i.e. in this caseNDFrame
. Then we're callingNDFrame
with aDataFrame
(the result ofconcat
with more that 1 column). Finally the mypy type error seems to come fromDataFrame
in the__init__
ofNDFrame
which specifies the first argument is aManager
and not a DataFrame.I guess given the return signature of
concat
isSeries | DataFrame
this is technically correct, but it seems awkward to use theDataFrame
directly in the definition of the more generalNDFrame