0

I am new to Python. I am trying to create a 'smart merge' to merge df2 onto df1 on a hypothetical column called "Fruits" with the following conditions:

  1. If column in df2 not present in df1, join column on = "Fruits'
  2. If column in df2 is present in df1, replace column in df1

The columns in df2(except "Fruits") change everyday and this logic will subsequently be run everyday as well to ensure the joined dataset always includes the latest values and latest columns.

Thank you.

  • 1
    Welcome to SO! This could benefit from a [reproducible example](https://stackoverflow.com/questions/20109391/how-to-make-good-reproducible-pandas-examples) and a concrete, specific question about the implementation. It's better to show than tell. Where are you stuck, exactly? Thanks. – ggorlen Aug 24 '21 at 16:27

0 Answers0