Pandas: Merge data frames on datetime index

后端 未结 3 1539
天命终不由人
天命终不由人 2020-12-31 01:11

I have the following two dataframes that I have set date to DateTime Index df.set_index(pd.to_datetime(df[\'date\']), inplace=True) and would like to merge or j

3条回答
  •  攒了一身酷
    2020-12-31 01:30

    It looks like your dates are your indices, in which case you would want to merge on the index, not column. If you have two dataframes, df_1 and df_2:

    df_1.merge(df_2, left_index=True, right_index=True, how='inner')

提交回复
热议问题