-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
BUG: escapechar=',' Causes Double Commas in Output in Pandas 2.2.2 #59454
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
Thanks for the report, confirmed on main. Further investigations and PRs to fix are welcome. |
take |
The pandas relies on the writer in cpython's csv in order to save the data frame to the given csv file. The escapechar also passes to the writer as escapechar. And the quoting is set to the csv's default value, QUOTE_MINIMAL, if it is not given. Therefore the bug, if it is bug, is not in pandas, but in csv of cpython. ''' So I reported it to cpython community. After investigating a little bit more, I found that the usage in this case seems to be incorrect as well. ... |
I will keep an eye on the issue in cpython and post updates. |
Thanks for investigating! Closing this as an upstream issue. |
Pandas version checks
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
Issue Description
When using escapechar=',' in Pandas version 2.2.2, the resulting output includes double commas ,, in places where the data originally contained a comma. This behavior is inconsistent with Pandas version 1.4.3, where the escapechar did not cause this issue.
Steps to Reproduce:
Expected Behavior
The output CSV should properly escape commas without doubling them. The behavior should be consistent with previous Pandas versions where the escape character was used correctly.
Installed Versions
2.2.2
The text was updated successfully, but these errors were encountered: