标签: python sql pandas
如何在以下SQL查询中编写等效语句?
SELECT ISNULL(df2.id, df1.id) as new_id FROM dataframe1 df1 LEFT JOIN dataframe2 df2 ON df1.id = df2.id
答案 0 :(得分:1)
一个这样的等价物是:
df2.set_index('id').combine_first(df1.set_index('id')).reset_index()