合并pandas数据帧

时间:2017-06-30 03:54:35

标签: python pandas datetime merge

我有两个dfs,一个名为master:

     ARI     Flesch    Kincaid      time  VIX_close  FEDFUNDS  \
15.219540  40.099442  14.969857  01/02/08  26.128000  4.220000   
19.154130  38.308678  16.955482  01/02/08  26.128000  4.220000   
17.859696  35.896056  15.457418  01/02/13  13.446333  0.158667

 Baseline_overall_index  News_Based_Policy_Uncert_Index  
             110.973189                      120.994318  
             110.973189                      120.994318  
             190.472390                      213.912415  

第二个叫做数据:

     ARI     Flesch    Kincaid                 Speaker     Score  \
19.285543  26.507396  17.649118             Minutes FRC -1.697248   
15.010289  42.676816  13.966083  J. Alfred Broaddus Jr.  0.403775   
15.009436  42.707457  13.961809                     NaN  0.312579

    time
02/04/16
08/16/16
09/28/16

我想在'time'上合并dfs,这是一个datetime对象。此外,数据df中缺少个别日期,而所有日期都填写为master,尽管两个dfs可能每个日都有重复的条目。

运行下面的代码我得到以下输出:

代码:

remix = pd.merge(master, data)

输出:

Empty DataFrame
Columns: [ARI, Flesch, Kincaid, time, VIX_close, FEDFUNDS, 
Baseline_overall_index, News_Based_Policy_Uncert_Index, Speaker, 
Score, Residual, Date]
Index: []

0 个答案:

没有答案