0

If I have a Pandas Data frame like this:

      1      2     3     
 1 'taco'   NaN  'taco'
 2   NaN  'taco'  NaN
 3   NaN    NaN  'taco'

And another Pandas Data Frame Like this:

      1      2     3     
 1   NaN    NaN   NaN
 2 'Salt'   NaN  'Salt'
 3   NaN   'Salt' NaN

How do I combine my Pandas Data Frames such that I get something like this:

      1      2      3     
 1 'taco'   NaN   'taco'
 2 'Salt'  'taco' 'Salt'
 3   NaN   'Salt' 'taco'
Zmann3000
  • 806
  • 5
  • 13

1 Answers1

1

Considering you have dataframes named tacoDf and saltDf and one should only fill NaN values from the other:

tacoDf.fillna(saltDf)
Pedro Martins de Souza
  • 1,406
  • 1
  • 13
  • 35