title: Pandas to_csv slower with encoding?
body: <p>I'm having some performance issues transforming a dataframe to csv. </p>
  
  <pre><code>import numpy as np
  import pandas as pd
  from time import time
  
  t =time();_=pd.DataFrame(np.random.sample((10000,10))).to_csv(encoding=None); print time()-t
  0.159129142761
  t =time();_=pd.DataFrame(np.random.sample((10000,10))).to_csv(encoding='utf8'); print time()-t
  1.16141009331
  t =time();_=pd.DataFrame(np.random.sample((10000,10))).to_csv(encoding='ascii'); print time()-t
  1.13821101189
  </code></pre>
  
  <p>Why specifying an encoding type will affect drastically the performance of this method? In my particular case, I'd rather use the default value (None) but since the dataframe I need to convert contains some special chars (chinese) I cannot use the default encoding which has superior performance.</p>
  
  <p>Apparently, the default encoding is "<a href="http://pandas.pydata.org/pandas-docs/dev/generated/pandas.io.parsers.read_csv.html" rel="nofollow noreferrer">ascii</a>" but when selected has exactly the same performance as utf8, which is the one I need to use handle non-english char.</p>
  
  <p>Any idea how can I cope with speed and get around this problem?</p>
  
  <p>I'm using pandas 0.16.0 and Python 2.7.9.</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>I've upgrade to pandas <strong>0.16.2</strong> as per <a href="https://stackoverflow.com/users/1791279/rth">rth</a> suggestion, and I get better timings</p>
  
  <pre><code>import pandas as pd
  import numpy as np
  x = pd.DataFrame(np.random.sample((10000,10)))
  %timeit x.copy().to_csv(encoding='ascii')
  %timeit x.copy().to_csv()
  %timeit x.copy().to_csv(encoding='utf8')
  10 loops, best of 3: 160 ms per loop
  10 loops, best of 3: 73.7 ms per loop
  10 loops, best of 3: 158 ms per loop
  </code></pre>
  
  <p>Still it's half slower specifying an encoding than using the default encoding. Clearly better than the previous scenario using the 0.16.0 version, but still a tangible difference.</p>
  
  <p>I'm still keen to understand if it's a bug and how can I improve it... in my case it'a difference between 10 minutes or 20 minutes!</p>