-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
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
style.set_precision(0) displays spurious .0 #12134
Comments
looks a bit buggy, want to do a PR? |
Okay, I guess the Jinja2 docs recommend to do this by changing this to something like this: {% if c.value is number %}
{% if precision %}
{{c.value|round(precision)}}
{% else %}
{{c.value|round|int}}
{% endif %}
{% else %} Okay to put another branch like this into the inner loop? |
I think that is ok, the rendering time is not usually an issue (unless you are rendering millions of lines, which itself is an issue anyhow). |
|
Sorry, I didn't see this until now. I've got branch that is changing how the display formatting works, which is going to conflict with your PR in #12137. I believe I've fixed this bug in the change (here if you want to take a look at the relevant bit). I'm going to clean that up and submit sometime this week. It boils down to using formatting like In [4]: '{:0g}'.format(100.0)
Out[4]: '100' when your precision is 0 |
No problem, more control over formatting is nice, stepping back. Does this unify rendering of NaNs (IIRC df.style displays |
Closes pandas-dev#11692 Closes pandas-dev#12134 Closes pandas-dev#12125 This adds a `.format` method to Styler for formatting the display value (the actual text) of each scalar value. In the processes of cleaning up the template, I close pandas-dev#12134 (spurious 0) and pandas-dev#12125 (KeyError from using iloc improperly) cherry pick test from pandas-dev#12126 only allow str formatting for now fix tests for new spec formatter callable update notebook
Closes pandas-dev#11692 Closes pandas-dev#12134 Closes pandas-dev#12125 This adds a `.format` method to Styler for formatting the display value (the actual text) of each scalar value. In the processes of cleaning up the template, I close pandas-dev#12134 (spurious 0) and pandas-dev#12125 (KeyError from using iloc improperly) cherry pick test from pandas-dev#12126 only allow str formatting for now fix tests for new spec formatter callable update notebook
Closes pandas-dev#11692 Closes pandas-dev#12134 Closes pandas-dev#12125 This adds a `.format` method to Styler for formatting the display value (the actual text) of each scalar value. In the processes of cleaning up the template, I close pandas-dev#12134 (spurious 0) and pandas-dev#12125 (KeyError from using iloc improperly) cherry pick test from pandas-dev#12126 only allow str formatting for now fix tests for new spec formatter callable update notebook
The expected display format would be as in [2]:
The text was updated successfully, but these errors were encountered: