DataFrame.to_csv(quoting=csv.QUOTE_NONNUMERIC) now also quotes numeric values · Issue #13259 · pandas-dev/pandas (original) (raw)
Somewhere between 0.16.1 and 0.18.1, QUOTE_NONNUMERIC started also quoting numeric values unexpectedly.
import csv
df = pandas.DataFrame({
'c_string': ['a', 'b,c'],
'c_int': [42, numpy.nan],
'c_float': [1.0, 3.2],
'c_bool': [True, False],
})
print df.to_csv(quoting=csv.QUOTE_NONNUMERIC)
In 0.16.1, the output was:
"","c_bool","c_float","c_int","c_string"
0,True,1.0,42.0,"a"
1,False,3.2,"","b,c"
In 0.18.1, the output is:
"","c_bool","c_float","c_int","c_string"
0,True,"1.0","42.0","a"
1,False,"3.2","","b,c"