第一个数据帧(名为df1)是以下一个(头部):
id vn t pt
0 00000408662094209082085855047091571768_1 1 8/2/2016 9:52:32 category
1 00000408662094209082085855047091571768_2 2 8/2/2016 10:28:31 category
2 00000408662094209082085855047091571768_2 2 8/2/2016 10:29:11 category
3 00000408662094209082085855047091571768_2 2 8/2/2016 10:29:17 home
4 00000408662094209082085855047091571768_2 2 8/2/2016 10:29:31 home
,第二个(名为df2)是:
id c
14 00001087349068450135050866198201095168_1 1
37 00001894928540859901831574112552100393_10 1
179 00009266881488061960012264744075831635_7 1
302 00010448970554617030262224239139542299_1 1
354 00013397505232083416232379470282942830_1 1
当我这样做时:
df1.join(df2, on='id', how='left')
我收到以下错误:
C:\Users\asterios.BSQ_AD\AppData\Local\Continuum\Anaconda\lib\site-packages\pandas\core\format.py:2087: RuntimeWarning: invalid value encountered in greater
has_large_values = (abs_vals > 1e8).any()
C:\Users\asterios.BSQ_AD\AppData\Local\Continuum\Anaconda\lib\site-packages\pandas\core\format.py:2088: RuntimeWarning: invalid value encountered in less
has_small_values = ((abs_vals < 10 ** (-self.digits)) &
C:\Users\asterios.BSQ_AD\AppData\Local\Continuum\Anaconda\lib\site-packages\pandas\core\format.py:2089: RuntimeWarning: invalid value encountered in greater
(abs_vals > 0)).any()
返回的数据框在新的'c'列上有值'NaN',尽管我知道有些ID匹配。
为了完整性,以下是每个数据帧的信息:
DF1:
<class 'pandas.core.frame.DataFrame'>
Int64Index: 50000 entries, 0 to 49999
Data columns (total 4 columns):
id 50000 non-null object
vn 50000 non-null int64
t 50000 non-null object
pt 40411 non-null object
dtypes: int64(1), object(3)
memory usage: 2.3+ MB
DF2:
<class 'pandas.core.frame.DataFrame'>
Int64Index: 29300 entries, 14 to 2294263
Data columns (total 2 columns):
id 29300 non-null object
c 29300 non-null int64
dtypes: int64(1), object(1)
memory usage: 686.7+ KB
有什么想法吗?