python valueerror object2_df.join()遇到问题:ValueError:您正在尝试合并object和int64列…

这些问题都不能解决问题:问题1和问题2,我也无法在熊猫文档中找到答案。

您好,我正在尝试查找此错误的根本原因:

ValueError: You are trying to merge on object and int64 columns.

我知道我可以使用熊猫concat或merge函数来解决此问题,但是我正在尝试了解错误的原因。问题是:为什么我要得到这个ValueError?

这是head(5)和info()所使用的两个数据帧的输出。

print(the_big_df.head(5))输出:

account apt apt_p balance date day flag month reps reqid year

0 AA0420 0 0.0 -578.30 2019-03-01 1 1 3 10 82f2d761 2019

1 AA0420 0 0.1 -578.30 2019-03-02 2 1 3 10 82f2d761 2019

2 AA0420 0 0.1 -578.30 2019-03-03 3 1 3 10 82f2d761 2019

3 AA0421 0 0.1 -607.30 2019-03-04 4 1 3 10 82f2d761 2019

4 AA0421 0 0.1 -610.21 2019-03-05 5 1 3 10 82f2d761 2019

print(the_big_df.info())输出:

RangeIndex: 36054 entries, 0 to 36053

Data columns (total 11 columns):

account 36054 non-null object

apt 36054 non-null int64

Original: https://blog.csdn.net/weixin_29056781/article/details/112958821
Author: 王释易
Title: python valueerror object2_df.join()遇到问题:ValueError:您正在尝试合并object和int64列…

原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/741654/

转载文章受原作者版权保护。转载请注明原作者出处!

(0)

大家都在看

亲爱的 Coder【最近整理,可免费获取】👉 最新必读书单  | 👏 面试题下载  | 🌎 免费的AI知识星球