Skip to content

Conversation

@ssche
Copy link
Contributor

@ssche ssche commented Sep 14, 2022

  • In previous versions, concatenating to empty EA was resetting type information to np.object

I wasn't sure which issue to reference since it was resolved as part of something else, so I took this one for which I only really added a test case (not the actual fix). @mroeschke would you like me to reference another issue instead (or remove this from whatsnew entirely)?

Sven added 2 commits September 14, 2022 15:40
* In previous versions, concatenating to empty EA was resetting type information to np.object
@ssche ssche requested a review from mroeschke September 14, 2022 05:54
@mroeschke mroeschke added Testing pandas testing functions or related to the test suite Reshaping Concat, Merge/Join, Stack/Unstack, Explode labels Sep 14, 2022
* whatsnew: made "Loss of dtype" more specific and improved wording (EA -> ExtensionArray, etc)
* testcase: moved test case to test_empty.py and use `tm.assert_frame_equal()` with an expected dataframe
ExtensionArray
^^^^^^^^^^^^^^
- Bug in :meth:`Series.mean` overflowing unnecessarily with nullable integers (:issue:`48378`)
- When concatenating DataFrame containing an empty ExtensionArray Series with another DataFrame with an ExtensionArray of the same type, the resulting dtype turned into object (:issue:`48510`)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
- When concatenating DataFrame containing an empty ExtensionArray Series with another DataFrame with an ExtensionArray of the same type, the resulting dtype turned into object (:issue:`48510`)
- Bug when concatenating an empty DataFrame with an ExtensionDtype to another DataFrame with the same ExtensionDtype, the resulting dtype turned into object (:issue:`48510`)

@mroeschke
Copy link
Member

Sven added 2 commits September 15, 2022 10:43
* Use concat/DataFrame as they were directly imported (instead of `pd...`)
@mroeschke mroeschke added this to the 1.6 milestone Sep 15, 2022
@mroeschke mroeschke added the NA - MaskedArrays Related to pd.NA and nullable extension arrays label Sep 15, 2022
@mroeschke mroeschke merged commit d5c0f57 into pandas-dev:main Sep 15, 2022
@mroeschke
Copy link
Member

Thanks @ssche

@ssche ssche deleted the gh-48510-concat-to-empty-ea-removes-type-info branch September 16, 2022 08:15
@mroeschke mroeschke modified the milestones: 1.6, 2.0 Oct 13, 2022
noatamir pushed a commit to noatamir/pandas that referenced this pull request Nov 9, 2022
* Added test case to lock in behaviour

* In previous versions, concatenating to empty EA was resetting type information to np.object

* Update whatsnew

* Addressed code review comments

* whatsnew: made "Loss of dtype" more specific and improved wording (EA -> ExtensionArray, etc)
* testcase: moved test case to test_empty.py and use `tm.assert_frame_equal()` with an expected dataframe

* Fixed style issue

* Use concat/DataFrame as they were directly imported (instead of `pd...`)

* Improved whatsnew entry as per suggestion

Co-authored-by: Sven <you@example.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

NA - MaskedArrays Related to pd.NA and nullable extension arrays Reshaping Concat, Merge/Join, Stack/Unstack, Explode Testing pandas testing functions or related to the test suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: Appending or concatenating to empty ExtensionArray removes type information

2 participants