Skip to content
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

Added test case to lock in behaviour #48541

Merged
merged 5 commits into from
Sep 15, 2022
Merged

Added test case to lock in behaviour #48541

merged 5 commits into from
Sep 15, 2022

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
@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
@@ -212,6 +212,7 @@ Sparse
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