Skip to content
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

Add formatters parameter to DataFrame.to_csv() #16840

Closed
adamboche opened this issue Jul 6, 2017 · 3 comments
Closed

Add formatters parameter to DataFrame.to_csv() #16840

adamboche opened this issue Jul 6, 2017 · 3 comments
Labels
Duplicate Report Duplicate issue or pull request IO CSV read_csv, to_csv Output-Formatting __repr__ of pandas objects, to_string

Comments

@adamboche
Copy link

DataFrame.to_string() has a formatters parameter for formatting columns individually, but to_csv() could benefit from that parameter as well. This is especially useful, for example, when formatting integers with missing values.

@jreback
Copy link
Contributor

jreback commented Jul 6, 2017

duplicate of #4668

yep, would be nice to have. interested in a PR?

@jreback jreback added Duplicate Report Duplicate issue or pull request IO CSV read_csv, to_csv Output-Formatting __repr__ of pandas objects, to_string labels Jul 6, 2017
@jreback jreback added this to the No action milestone Jul 6, 2017
@TomAugspurger
Copy link
Contributor

Closing in favor of #4668

@moi90
Copy link
Contributor

moi90 commented Jul 12, 2023

Actually, this is NOT a duplicate of #4668. There, float_format is talked about, but this applies to all columns. A formatters parameter, similar to to_string could apply different formats to different columns (and this is exactly what I need).

I request to reopen.

(I also just had a look at DataFrame.to_csv and it seems that is not that easy to rewrite to accept individual formatters for each column...)

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

4 participants