title: Match values between 2 data frame and update using user defined function
body: <pre><code>Dataframe1 = IndicatorDF - columns ['Code', 'Name', 'Indicator']
  
  Dataframe2 = IndicatorRSK - columns ['Indicator', 'Code', 'Name']
  </code></pre>
  
  <p>Want to update <code>Dataframe1</code> filed: Indicator by mapping with <code>Dataframe2</code> where <code>IndicatorDF['Code'] == IndicatorRSK['Code']</code> &amp; update <code>IndicatorRSK['Indicator']</code> values to <code>IndicatorDF['Indicator']</code></p>
  
  <p>Below script works fine, But I want update for many dataframe. Can we do this using user defined function.</p>
  
  <pre><code>mappingD = IndicatorDF[['Code', 'Indicator']].set_index('Code')
  mappingD.update(IndicatorRSK.set_index('Code'))
  IndicatorDF['Indicator'] = mappingD.values
  </code></pre>
  
  <p>I wrote below function, but not working, please help on the same.</p>
  
  <pre><code>IndicatorDF = pd.read_excel(r'C:\sunil_plus\dataset\imf\IMFBOP2017\4_Updation2017Apr\IMFBOP2017.xlsx', sheetname = 'Indicator')
  IndicatorDF['Indicator'] = ''
  
  IndicatorRSK = pd.read_csv(r'C:\sunil_plus\dataset\imf\IMFBOP2017\4_Updation2017Apr\Prod_IMFBOP2017\Prod_IMFBOP2017_Indicator.csv', dtype=object)
  IndicatorRSK.rename(columns={'Key': 'Indicator'}, inplace=True)
  
  def mapping(resultDF, indexCol, resultCol, mapDF, mapIndex):
      mappingD = resultDF[[indexCol, resultCol]].set_index(indexCol)
      mappingD.update(mapDF.set_index(mapIndex))
      resultDF[resultCol] = mappingD.values
      return
  
  mapping('IndicatorDF', 'Code', 'Indicator', 'IndicatorRSK', 'Code') # passing data frame name and field name
  
  IndicatorDF.to_csv(r'C:\sunil_plus\dataset\imf\IMFBOP2017\4_Updation2017Apr\Prod_IMFBOP2017\mapped.csv', index=False)
  </code></pre>