Skip to content

DataFrame.to_csv(quoting=csv.QUOTE_NONNUMERIC) now also quotes numeric values #13259

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jeremywhelchel opened this issue May 23, 2016 · 1 comment
Labels
Duplicate Report Duplicate issue or pull request IO CSV read_csv, to_csv Output-Formatting __repr__ of pandas objects, to_string

Comments

@jeremywhelchel
Copy link

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"
@jreback
Copy link
Contributor

jreback commented May 23, 2016

this is a dupe of #12922

its an easy fix if you want to submit a PR

@jreback jreback closed this as completed May 23, 2016
@jreback jreback added API Design IO CSV read_csv, to_csv Duplicate Report Duplicate issue or pull request Output-Formatting __repr__ of pandas objects, to_string and removed API Design labels May 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate Report Duplicate issue or pull request IO CSV read_csv, to_csv Output-Formatting __repr__ of pandas objects, to_string
Projects
None yet
Development

No branches or pull requests

2 participants