合并两个数据框返回空数据框

时间:2019-11-24 22:55:53

标签: python pandas dataframe

我知道关于这个主题有几个话题,但是我找不到问题。

我有这两个数据集。 1)

    Acceleration TimeStamp  Orientation Roll    GPS TimeStamp
6779    320403257995955 -7.243041   1574434597335
6780    320403257995955 -7.243041   1574434597335
6781    320403257995955 -7.243041   1574434597335
6782    320403257995955 -7.243041   1574434597335
6783    320403257995955 -7.243041   1574434597335
... ... ... ...
665729  323040931878676 -4.196351   1574437233999
665730  323040931878676 -4.196351   1574437233999
665731  323040931878676 -4.196351   1574437233999
665732  323040931878676 -4.196351   1574437233999
665733  323040931878676 -3.414388   1574437233999


<class 'pandas.core.frame.DataFrame'>
Int64Index: 642240 entries, 6779 to 665733
Data columns (total 3 columns):
Acceleration TimeStamp    642240 non-null int64
Orientation Roll          642240 non-null float64
GPS TimeStamp             642240 non-null int64
dtypes: float64(1), int64(2)
memory usage: 19.6 MB

和第二个: 2)

    GPS TimeStamp   label
0   1574031948506   Test
1   1574031951753   Test
2   1574031963877   Test
3   1574031965392   Test
4   1574058933490   Test
... ... ...
3864    1574436948345   Test
3865    1574436956346   Test
3866    1574436960131   Test
3867    1574436967700   Test
3868    1574436971377   Test

<class 'pandas.core.frame.DataFrame'>
RangeIndex: 3869 entries, 0 to 3868
Data columns (total 2 columns):
GPS TimeStamp    3869 non-null int64
label            3869 non-null object
dtypes: int64(1), object(1)
memory usage: 60.5+ KB

“ GPS时间戳”列的dtype用于两个数据帧int64。

执行中:

df_result = pd.merge(df_short,df2, on="GPS TimeStamp")

返回一个空的数据框。谢谢您的帮助!

0 个答案:

没有答案