Skip to content

Merging on int64 and object columns, pandas 0.23.4 #23733

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

Closed
YanTianqi opened this issue Nov 16, 2018 · 3 comments · Fixed by #21681
Closed

Merging on int64 and object columns, pandas 0.23.4 #23733

YanTianqi opened this issue Nov 16, 2018 · 3 comments · Fixed by #21681
Labels
Numeric Operations Arithmetic, Comparison, and Logical operations Reshaping Concat, Merge/Join, Stack/Unstack, Explode
Milestone

Comments

@YanTianqi
Copy link

Problem description

Hi, I was trying to merge 2 data frame based on a column named ID, which consists of integer.

In the case the ID column is of type numpy.int64 in one df, and of python native int in the other df. In the latest version of 0.23.4, I received this error

ValueError: Your are tryign to merge on int64 and object columns, If you wish to proceed you should use pd.concat

Attached the screenshot of the problem

image

I have never encountered this situation in earlier panda version such as 0.22.0. The same code ran without an issue.

May I know what is the purpose of adding this constraint in the upgraded version?

@TomAugspurger
Copy link
Contributor

I think #9780 is the relevant issue.

IIRC, trying to merge between object-dtype columns and more specialized types was causing issues.

@gfyoung gfyoung added Reshaping Concat, Merge/Join, Stack/Unstack, Explode Numeric Operations Arithmetic, Comparison, and Logical operations labels Nov 16, 2018
@YanTianqi
Copy link
Author

@TomAugspurger I think the difference between #9780 is that in the previous version, it was not failure without raising error, but rather merging successfully instead.

@TomAugspurger
Copy link
Contributor

Gotcha, I think this will be closed by #21681, but upcasting to object.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Numeric Operations Arithmetic, Comparison, and Logical operations Reshaping Concat, Merge/Join, Stack/Unstack, Explode
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants