8000 ENH: try to preserve the dtype on combine_first for the case where the two DataFrame objects have the same columns by danielhrisca · Pull Request #39051 · pandas-dev/pandas · GitHub
[go: up one dir, main page]

Skip to content

ENH: try to preserve the dtype on combine_first for the case where the two DataFrame objects have the same columns #39051

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
merged 13 commits into from
Jan 15, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix misspelled word in docstring
  • Loading branch information
danielhrisca committed Jan 11, 2021
commit 24f6ffcff8c750f76288921e48f113f56116d71c
2 changes: 1 addition & 1 deletion pandas/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -6441,7 +6441,7 @@ def combine_first(
Provided DataFrame to use to fill null values.

preserve_dtypes : bool, default False
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we do not want to add a flag for this. simply change it.

Please add some examples for this behaivor

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking that maybe it is a good idea to keep the current behavior as default, and provide the new behavior as an option

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no its better to just fix this, you can add a whatsnew note in 1.3. everywhere else we cast to common dtypes, this should be no different.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm running into some failed tests that exceed my understand of the lib. Is it expected that if a Series is constructed from a list of None then the result of this combined with some other Series should have the latter's dtype (coercing to the respective NaN value)?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

list of None -> object, so combined -> object

try to preserve the column dtypes afetr combining
try to preserve the column dtypes after combining

.. versionadded:: 1.2.1

Expand Down
0