合并两个数据帧时的值错误

时间:2016-06-22 07:10:08

标签: python python-2.7 merge

我有2个数据框:

UIFont.monospacedDigitSystemFontOfSize(, weight: )

visit_final.iloc[0:10]
Out[48]: 
         mac_address  no. of visit during peak hour
0  00:02:1a:11:b0:b9                              1
1  00:02:71:d6:04:84                              1
2  00:05:33:34:2f:f2                              1
3  00:08:22:04:c4:fb                              1
4  00:08:22:06:7b:41                              1
5  00:08:22:07:48:15                              1
6  00:08:22:08:a8:54                              1
7  00:08:22:0e:0a:fc                              1
8  00:08:22:10:4f:d0                              1

我正在尝试使用

合并这两个
iphone_final.iloc[0:10]
Out[47]: 
         mac_address  no. of high iphone co_visit
0  00:02:1a:11:b0:b9                            1
1  00:02:71:d6:04:84                            1
2  00:05:33:34:2f:f2                            1
3  00:08:22:04:c4:fb                            1
4  00:08:22:06:7b:41                            1
5  00:08:22:07:48:15                            1
6  00:08:22:08:a8:54                            1
7  00:08:22:0e:0a:fc                            1
8  00:08:22:10:4f:d0                            1
9  00:08:22:14:e1:fb                            1

但这会产生错误

final = pd.merge('visit_final','iphone_final', how = 'outer', on =['mac_address'])

知道如何解决这个问题吗?

1 个答案:

答案 0 :(得分:1)

代码中的问题:您正在尝试合并到string类型的对象...

final = pd.merge("a","b", how = 'outer', on =['mac'])

但你应该宁愿:

final = pd.merge(a, b, how = 'outer', on =['mac'])

所以只需删除变量周围的引号。