Dataframe 1(Df1):
date L120_active_cohort_logins L120_active_cohort percentage_L120_active_cohort_logins
0 2022-09-01 32679 195345 16.728865
1 2022-09-02 32938 196457 16.766010
2 2022-09-03 40746 197586 20.621906
3 2022-09-04 33979 198799 17.092138Dataframe 2(df2):-
date L120_active_cohort_logins L120_active_cohort percentage_L120_active_cohort_logins
0 2022-09-01 32677 195345 16.728864
1 2022-09-02 32938 196457 16.766010
2 2022-09-03 40746 197586 20.621906
3 2022-09-04 33979 198799 17.092138结果df3 = df2 - df1 I希望df2不匹配df1特定行存储在df3中
产出:-
date L120_active_cohort_logins L120_active_cohort percentage_L120_active_cohort_logins
0 2022-09-01 32677 195345 16.728864发布于 2022-09-09 12:25:59
参考Comparing two dataframes and getting the differences
new_df = pd.concat([df1,df2]).drop_duplicates(keep=False)
new_df[~new_df.index.duplicated(keep='last')]https://stackoverflow.com/questions/73662035
复制相似问题