-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
ENH/BUG: pass formatting params thru to to_csv
#5414
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
ENH/BUG: pass formatting params thru to to_csv
#5414
Conversation
Can't just add this...needs to be supported by C parser too (and therefore needs tests, etc) |
Yea, I didn't expect it to be that easy. Is it better etiquette to close this PR and reopen later or just leave it hanging? |
oh this is to_csv -- just need to put together some tests for this. |
does this close an issue? need tests for this |
I realized this commit was doing two things so I refactored into a separate PR (#6034). I'm still a little lost on what kind of test to make though since these params are just passed internally to The only thing that occurs to me is to write an output file using the new parameters then read it back in and make sure the write occurred correctly. Is that overkill? Any tips or hints what to model the test(s) on? |
This PR seems to cover #4528 too |
I tried using |
Specifically it fails like this: Traceback (most recent call last):
File "/home/travis/virtualenv/python2.6_with_system_site_packages/lib/python2.6/site-packages/pandas/tests/test_format.py", line 1729, in test_to_csv_quotechar
df.to_csv(path, quoting=1, quotechar=None)
File "/usr/lib/python2.6/contextlib.py", line 34, in __exit__
self.gen.throw(type, value, traceback)
File "/home/travis/virtualenv/python2.6_with_system_site_packages/lib/python2.6/site-packages/pandas/util/testing.py", line 372, in ensure_clean
yield filename
File "/home/travis/virtualenv/python2.6_with_system_site_packages/lib/python2.6/site-packages/pandas/tests/test_format.py", line 1728, in test_to_csv_quotechar
with self.assertRaises(TypeError):
TypeError: failUnlessRaises() takes at least 3 arguments (2 given) |
Use https://github.com/pydata/pandas/wiki/Testing#wiki-testing-for-exceptions |
Thanks @TomAugspurger |
@patricktokeeffe pls rebase, and move the release notes to 0.14 section. thanks which issues does this cover? |
- Add `quotechar`, `doublequote`, and `escapechar` parameters - Add tests for each new param - Update relevant docs
ENH/BUG: pass formatting params thru to `to_csv`
thanks nice little fix! |
Add support for passing remaining
csv.writer
formatting parameters thru toDataFrame.to_csv()
.Maybe write tests for this? That much is over my head currently.