title: Python 'map' function inserting NaN, possible to return original values instead?
body: <p>I am passing a dictionary to the <code>map</code> function to recode values in the column of a Pandas dataframe. However, I noticed that if there is a value in the original series that is not explicitly in the dictionary, it gets recoded to <code>NaN</code>. Here is a simple example:</p>
  
  <p>Typing...</p>
  
  <pre><code>s = pd.Series(['one','two','three','four'])
  </code></pre>
  
  <p>...creates the series</p>
  
  <pre><code>0      one
  1      two
  2    three
  3     four
  dtype: object
  </code></pre>
  
  <p>But applying the map...</p>
  
  <pre><code>recodes = {'one':'A', 'two':'B', 'three':'C'}
  s.map(recodes)
  </code></pre>
  
  <p>...returns the series</p>
  
  <pre><code>0      A
  1      B
  2      C
  3    NaN
  dtype: object
  </code></pre>
  
  <p>I would prefer that if any element in series <code>s</code> is not in the <code>recodes</code> dictionary, it remains unchanged. That is, I would prefer to return the series below (with the original <code>four</code> instead of <code>NaN</code>).</p>
  
  <pre><code>0      A
  1      B
  2      C
  3   four
  dtype: object
  </code></pre>
  
  <p>Is there an easy way to do this, for example an option to pass to the <code>map</code> function? The challenge I am having is that I can't always anticipate all possible values that will be in the series I'm recoding - the data will be updated in the future and new values could appear. </p>
  
  <p>Thanks!</p>