title: Replace invalid values with None in Pandas DataFrame
body: <p>Is there any method to replace values with <code>None</code> in Pandas in Python?</p>
  
  <p>You can use <code>df.replace('pre', 'post')</code> and can replace a value with another, but this can't be done if you want to replace with <code>None</code> value, which if you try, you get a strange result.</p>
  
  <p>So here's an example:</p>
  
  <pre><code>df = DataFrame(['-',3,2,5,1,-5,-1,'-',9])
  df.replace('-', 0)
  </code></pre>
  
  <p>which returns a successful result.</p>
  
  <p>But,</p>
  
  <pre><code>df.replace('-', None)
  </code></pre>
  
  <p>which returns a following result:</p>
  
  <pre><code>0
  0   - // this isn't replaced
  1   3
  2   2
  3   5
  4   1
  5  -5
  6  -1
  7  -1 // this is changed to `-1`...
  8   9
  </code></pre>
  
  <p>Why does such a strange result be returned?</p>
  
  <p>Since I want to pour this data frame into MySQL database, I can't put <code>NaN</code> values into any element in my data frame and instead want to put <code>None</code>. Surely, you can first change <code>'-'</code> to <code>NaN</code> and then convert <code>NaN</code> to <code>None</code>, but I want to know why the dataframe acts in such a terrible way.</p>
  
  <blockquote>
    <p>Tested on pandas 0.12.0 dev on Python 2.7 and OS X 10.8. Python is a
    pre-installed version on OS X and I installed pandas by using SciPy
    Superpack script, for your information.</p>
  </blockquote>