Skip to content

float_format string error #9531

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
quebbs opened this issue Feb 20, 2015 · 1 comment
Closed

float_format string error #9531

quebbs opened this issue Feb 20, 2015 · 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

@quebbs
Copy link

quebbs commented Feb 20, 2015

The float_format string works for single values i.e. float_format='%.1f', but it does not appear to work for a formatted string of columns. For example, If I had four columns with increasing significant digits, separated with tabs:

fmt_string='%.1f\t%.2f\t%.3f\t%.4f'

Then for some DataFrame X, I should be able to use:

X.to_csv('./out.txt',float_format=fmt_string,index=False)

But it unfortunately balks at me:

TypeError: not enough arguments for format string
@jreback
Copy link
Contributor

jreback commented Feb 20, 2015

see #4668

I think there is a wish to support a float_format=dict_of_formatters, but it is not implemented
want to submit a pull-request?

@jreback jreback closed this as completed Feb 20, 2015
@jreback jreback added Output-Formatting __repr__ of pandas objects, to_string Duplicate Report Duplicate issue or pull request IO CSV read_csv, to_csv labels Feb 20, 2015
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