ValueError:您正在尝试合并object和int64列。如果您希望继续,您应该使用pd.concat
您好,我正在尝试执行模糊匹配器代码,但出现以下错误:ValueError:您正在尝试合并object和int64列。如果您希望继续,您应该使用pd.concat,object,join,merge,valueerror,int64,Object,Join,Merge,Valueerror,Int64,您好,我正在尝试执行模糊匹配器代码,但出现以下错误: ValueError: You are trying to merge on object and int64 columns. If you wish to proceed you should use pd.concat 即使我要匹配的列的类型相同,这种情况也会发生。左侧的变量是P009\u 01、P009\u 2、P009\u 03,右侧的数据帧是apellido1、apellido2、names df1.dtypes P001
ValueError: You are trying to merge on object and int64 columns. If you wish to proceed you should use pd.concat
即使我要匹配的列的类型相同,这种情况也会发生。左侧的变量是P009\u 01、P009\u 2、P009\u 03
,右侧的数据帧是apellido1、apellido2、names
df1.dtypes
P001 int64
P002 int64
P003 int64
P017 object
P020_01 float64
WP109 int64
WP114 int64
WP115 int64
P009_01 object
P009_02 object
P009_03 object
tenure_security float64
inv2 object
P086_01 object
inv7 object
inv11 object
P121 float64
c_ubigeo int64
dtype: object
另一个:
df2.dtypes
COD_PREDIO object
AREA_HA float64
DEPARTAMENTO object
PREDIO object
NUM_PREDIO int64
ID_DIST int64
ID_PROV int64
P001 int64
P009_01 object
P009_02 object
P009_03 object
P002 int64
P003 int64
p_ubigeo int64
ubigeo int64
apellido1 object
apellido2 object
nombres object
PETT_0 int64
dtype: object
需要匹配的变量来自同一类型,所以我看不出问题出在哪里,有人能发现吗?
下面是代码:
matched_results = fuzzymatcher.fuzzy_left_join(df1,
df2,
left_on,
right_on,
left_id_col = 'P003',
right_id_col = 'ID_DIST')
我错过什么了吗?
提前谢谢