-
- Notifications
You must be signed in to change notification settings - Fork 19.4k
ENH: add decimal and thousands args to Styler.format() #40596
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: add decimal and thousands args to Styler.format() #40596
Conversation
…ousands # Conflicts: # pandas/io/formats/style.py # pandas/tests/io/formats/style/test_style.py
pandas/io/formats/style.py Outdated
| is a (float, complex). | ||
| """ | ||
| | ||
| def wrapper(x): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we share code with FloatArrayFormatter in pandas/io/format.py ?
may need to refactor to do that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
taking a quick look:
- there doesn't seem to be an inherent option for
thousands, justdecimalreplacement in that code. - the FloatArrayFormatter is vectorised but
Stylerdoesdisplay_funcselement-wise (which it can't avoid for processing individual cell styles). I guess this makes it very difficult to refactor across module (unless the fomat_class was called element-wise) - other parameters such as
escapeandsubsetwould have to be wrapped around the format.py code, so it might end up equally complicated anyway?
will have a think over next day.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jreback I think the refactor is too complicated at this stage since:
- FloatArrayFormatter doesnt have the
thousandsargument which is main part of this PR. - the above problem about column vectorisation versus element-wise (and the
stylersubsetargument) - the other arguments finding it difficult to exactly replicate existing behaviour.
…ousands # Conflicts: # pandas/tests/io/formats/style/test_style.py
…ousands # Conflicts: # pandas/io/formats/style.py
| thanks @attack68 |
A PR for Europeans: