You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
cell_ids: bool, default True
If True, each cell will have an id attribute in their HTML tag. The id takes the form T__row<num_row>_col<num_col> where is the unique identifier, <num_row> is the row number and <num_col> is the column number.
This doesn't seem to work.
Consider the example in the docs:
import pandas as pd # NOTE VERSION 1.1.0
from pandas.io.formats.style import Styler
def highlight_max(s):
x = s == s.max()
x = x.replace(False, '')
x = x.replace(True, 'background-color: yellow; color: brown')
return x
df = pd.DataFrame(data=[[0,1], [1,0]])
s = Styler(df, uuid='_', cell_ids=False)
s.apply(highlight_max)
s.render()
This will still render id css tags for all cells even though it should have been ignored on some.
Reason and Solution
Upon render, within the code a ctx defaultdict object contains the properties for each cell:
Pandas Styler has the following argument:
This doesn't seem to work.
Consider the example in the docs:
This will still render
id
css tags for all cells even though it should have been ignored on some.Reason and Solution
Upon render, within the code a
ctx
defaultdict object contains the properties for each cell:On line 393 we have the condition:
This fails because the
_update_ctx
function handles empty string by not adding to thectx
- previously I suspect it performed differently..We should really change line 393 to:
I added a PR for this..
The text was updated successfully, but these errors were encountered: