title: How to correctly use pandas Series.map() with a dictionary of mappings?
body: <p>The dataframe smaller_df looks like this:</p>
  
  <pre><code>&gt; smaller_df.head()
     MSA Code  Line   RPP
  0     10180   1.0  91.2
  1     10180   2.0  97.4
  2     10180   3.0  78.7
  3     10180   4.0  93.5
  4     10420   1.0  90.4
  ...
  </code></pre>
  
  <p>smaller_df.dtypes results in</p>
  
  <pre><code>MSA Code      int64
  Line        float64
  RPP         float64
  Wages        object
  dtype: object
  </code></pre>
  
  <p>wage_keys.head() gives:</p>
  
  <pre><code>   MSA Code  Average Wage
  0     11260  94490.000000
  1     21820  72080.000000
  2     10180  71128.571429
  3     13820  87338.396624
  4     10420  76620.000000
  ...
  </code></pre>
  
  <p>wage_keys.dtypes is:</p>
  
  <pre><code>MSA Code          int64
  Average Wage    float64
  dtype: object
  </code></pre>
  
  <p>Note that the same 'MSA Code" can appear multiple times in smaller_df, but exactly once in wage_keys.</p>
  
  <p>I want the new column 'Wages' in smaller_df to be set to the corresponding value in wage_keys.</p>
  
  <p>So the new table should look like this:</p>
  
  <pre><code>   MSA Code  Line   RPP Wages
  0     10180   1.0  91.2   71128.571429
  1     10180   2.0  97.4   71128.571429
  2     10180   3.0  78.7   71128.571429
  3     10180   4.0  93.5   71128.571429
  4     10420   1.0  90.4   76620.000000
  ...
  </code></pre>
  
  <p>I have the following code to do the mapping, by making a dictionary of wages:</p>
  
  <pre><code>wages = wage_keys.set_index('MSA Code').to_dict()
  smaller_df['Wages'] = smaller_df['MSA Code'].map(wages)
  </code></pre>
  
  <p>The problem is this results in:</p>
  
  <pre><code>   MSA Code  Line   RPP Wages
  0     10180   1.0  91.2   NaN
  1     10180   2.0  97.4   NaN
  2     10180   3.0  78.7   NaN
  3     10180   4.0  93.5   NaN
  4     10420   1.0  90.4   NaN
  </code></pre>
  
  <p>Obviously, I'm missing something.  How do get the values for the 'Wages' column to set to the correct corresponding value in the wages dictionary (or wage_key dataframe)?</p>