-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Undesired behaviour using to_csv with QUOTE_NONE #10783
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
Comments
Maybe consider not using commas in your data or using something other than commas (like pipes) to delimit your file? |
This is the expected behaviour, since you explicitly told E.g. using a backslash to escape the comma:
What do you exactly want to obtain? |
I am closing this issue as it is not a bug, but we can certainly discuss further what you are looking for. |
@kawochen using '|' as delimiter solved the problem. I got the following output:
@jorisvandenbossche I understood the mistake in trying to use ',' as the delimiter since one of the fields was already having ',' in the data field, hence creating the difficulty with csv.QUOTE_NONE. Thanks guys. |
Hi,
My data frame contains unicode strings. Now when I use 'to_csv' without any quoting parameter, I get a csv file where certain fields (2 out of 11 to be exact) are in double quotes. For example:
28,"May 8, 2013 10:22 AM","76th St, Yates Blvd",41.75717,-87.56633,3,-,1,4,-
Now when I use csv.QUOTE_NONE i get the following error:
Error: need to escape, but no escapechar set
So i do the following (quoting=csv.QUOTE_NONE, escapechar='"'), and I get this:
28,May 8", 2013 10:22 AM,76th St", Yates Blvd,41.75717,-87.56633,3,-,1,4,-
So I get a new quote (") in those 2 fields. How to get around this problem? Thanks.
Sample code is below:
The text was updated successfully, but these errors were encountered: