-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Mixed dtypes of column index for data frames raises en error #47382
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
Comments
This used to work with earlier pandas versions. |
Hi, thanks for your report. Could you reduce your example a bit? The pivots are not necessary to reproduce the bug :) see https://matthewrocklin.com/blog/work/2018/02/28/minimal-bug-reports |
OK. Here is a reduced code snippet exhibiting the same issue: import pandas as pd
d = pd.DataFrame(columns=list('abc'), data=0.0, index=[0])
e = pd.DataFrame(columns=list('abc'), data=0.0, index=[0])
e.columns = e.columns.astype('string')
d+e ## raises an unexpected exception Fails with pandas 1.4.2, works fine with pandas 1.2.4 Traceback:
Fails with pandas 1.4.2, i.e.:
works fine with 1.2.4.
|
Thx, this is great. I'll edited the initial post. This is caused by #33940, depending on the resolution there, this might vanish or not |
This works on main, could use a test. |
Here is a snippet of code summarizing the issue (pandas 1.4.2, various versions of python).
The simple addition of 2 arrays of apparently the same shape ends with the following exception:
The dtypes of the columns of p1 and p2 are respectively:
and that seems to cause the issue.
I would expect the formula
p1+p2
to work likep1+p1
.The text was updated successfully, but these errors were encountered: