title: Pandas to_numeric numerical precision
body: <h2>Preface</h2>
  
  <p>I'll preface this by saying two things:</p>
  
  <ul>
  <li>I'm new(er) to python/pandas, and trying not to reinvent the wheel</li>
  <li>I've read the documentation for <a href="http://pandas.pydata.org/pandas-docs/version/0.20/generated/pandas.to_numeric.html" rel="nofollow noreferrer">pandas.to_numeric</a></li>
  <li>I've read <a href="https://stackoverflow.com/questions/21895756/why-are-floating-point-numbers-inaccurate">Why Are Floating Point Numbers Inaccurate?</a> and <a href="http://stackoverflow.com/questions/1089018/why-cant-decimal-numbers-be-represented-exactly-in-binary">Why can't decimal numbers be represented exactly in binary?</a>. I understand the concepts we're working with here, and am trying to figure out a "good" solution to getting a modicum of precision</li>
  <li>I know it would be easier to ensure users only enter numbers, but I don't have control over the source data; the program is a large-scale data validation tool which has to accept everything from the user no matter what was provided</li>
  </ul>
  
  <h2>Background</h2>
  
  <p>I'm working on porting a project from R to python, and am struggling to find a good way to translate a text-to-float conversion process. Specifically, I'm:</p>
  
  <ul>
  <li>Reading a pandas dataframe in from a SQL database (pandas.read_sql)</li>
  <li>Casting a column which is stored as text back into a number using pd_to_numeric
  
  <ul>
  <li>Using the <code>error='coerce'</code> option to force the coercion from text to floats </li>
  <li>Checking the before/after to see if/where input was coerced to NaN</li>
  </ul></li>
  </ul>
  
  <h2>Question</h2>
  
  <p><strong>How to I get pandas to neatly coerce a text representation of a float value to the corresponding float cleanly?</strong></p>
  
  <p>The issue I'm running into is with the numerical precision. For example:</p>
  
  <pre><code>In[1]: pd.to_numeric('3.785', errors='coerce')
  Out[2]: 3.7850000000000001
  </code></pre>
  
  <p>I understand why that's happening (i.e. 3.785 is represented in a way that's not easily presentable in the underlying binary representation). What I'm trying to figure out is if there's a way to work around why it's happening efficiently.</p>
  
  <p>For example, in R, there's a lot that goes on under the hood, but in the as.numeric API, you get the number that's ostensibly represented by the text value:</p>
  
  <pre><code>&gt; as.numeric('3.785')
  [1] 3.785
  </code></pre>
  
  <p>which is my desired behavior. Is that possible using pandas/python?  I'm open to incorporating other packages, or being told "that's impossible." </p>