title: Pandas replace with string and integers - incorrect behavior?
body: <p>I encountered a potentially incorrect behavior of pandas <code>.replace()</code> function, for strings and integers. If the dataframe has both 0 (integer) and '0' (strings) then replace '0' affects both strings and integers.
  Here's how it goes:</p>
  
  <pre><code>In [1]: df = pd.DataFrame({'numbers' : [0, 1, 2, 0], 'strings' : ['0', 1, 2, '0']})
  </code></pre>
  
  <p>To check that it's indeed the correct setup:</p>
  
  <pre><code>In [2]: df.dtypes
  Out [2]:
  numbers     int64
  strings    object
  dtype: object
  </code></pre>
  
  <p>And check individual values:</p>
  
  <pre><code>In [3]: type(df['numbers'][0])
  Out[3]: numpy.int64
  In [4]: type(df['strings'][0])
  Out[4]: str
  </code></pre>
  
  <p>Now, do replace:</p>
  
  <pre><code>In [5]: df.replace(to_replace='0', value=np.NaN, inplace=True)
  In [6]: df.head()
  Out[6]: 
     numbers  strings
  0      NaN      NaN
  1        1        1
  2        2        2
  3      NaN      NaN
  </code></pre>
  
  <p>As you can see, it replaced both strings and integers, however it should have worked only on the strings. If we try the same on integers, it works correctly:</p>
  
  <pre><code>In [7]: df = pd.DataFrame({'numbers' : [0, 1, 2, 0], 'strings' : ['0', 1, 2, '0']})
  ...: df.replace(to_replace=0, value=np.NaN, inplace=True)
  ...: print df.head()
  Out [7]:   
     numbers strings
  0      NaN       0
  1        1       1
  2        2       2
  3      NaN       0
  </code></pre>
  
  <p>Is this the correct behavior or should I report a bug? I'm using pandas 0.19.0.</p>
  
  <p>Update: Bug reported and confirmed. @nickil-maveli provided the workaround that works in the meantime:
  <code>df.replace(to_replace=['0'], value=[np.NaN], inplace=True)</code></p>