-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
BUG: inconsistent concat casting EA vs non-EA #38843
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
Conversation
can you add a whatsnew note |
BTW, originally this is not directly related to having 2D EAs or not. The inconsistency already existed between DataFrame vs Series (because when concatting Series/SingleBlockManager, But so we should also tackle the general inconsistency between DataFrame and Series (which this PR might be doing already, but that should probably be made more explicit). For the actual behaviour we want, it's also an option to go for the DataFrame behaviour of not dropping empties. |
Yes it is. We pass axis=0 when we have EAs as a kludge bc they aren't 2D.
That's not unreasonable. |
hmm I though we did drop empties on DataFrame, but i guess not. yeah would be +1 on making that change for consistency. |
I think this was merged a bit too quickly. As noted above (#38843 (comment)), IMO there is much to say for solving it the other way around: changing Series behaviour to match the DataFrame behaviour (of not dropping empties).
I only wanted to mention that, even without EAs at all, we have an inconsistency in behaviour caused by the BTW, as general advice, I would recommend to stop constantly calling 1D EAs a "kludge", it's not helping the discussion in any way. |
The 1D EAs themselves are not the kludge, it is the workarounds that become necessary as a result of 1D EAs. In this case passing |
(Understood, but in general comments, it's not always clear to the reader which of both you mean, so I keep my advice ;)) Anyway, more importantly, can I get some response on the actual issue that I raised (the API change for concat with empties for DataFrame vs Series) ? |
I'm open to it. |
…)" This reverts commit 2362df9.
…)" This reverts commit 2362df9.
) * Revert "BUG: casting on concat with empties (pandas-dev#38907)" This reverts commit 04282c7. * Revert "BUG: inconsistent concat casting EA vs non-EA (pandas-dev#38843)" This reverts commit 2362df9.
black pandas
git diff upstream/master -u -- "*.py" | flake8 --diff
Because we dont have 2D EAs, we end up passing axis=0 to concat_compat from internals.concat. As a result we drop empty arrays only when EAs are present. This leads to dtypes being preserved in EA cases while being cast to object in non-EA cases.
One solution is just to support 2D EAs. But since I like the dropping-empties behavior better anyway, this is good too.