Closed
Description
Code Sample, a copy-pastable example
df = pd.DataFrame((np.random.rand(1, 1)*100))
s = df.style\
.applymap(lambda x: 'background-color: black;')\
.apply(lambda x: pd.DataFrame([['color: red;']]), axis=None)
print(s.render())
print(s.ctx)
print(s.render())
print(s.ctx)
...
<style type="text/css" >
#T_fda50_row0_col0{
background-color: black;
color: red;
}</style>
defaultdict(<class 'list'>, {(0, 0): ['background-color: black', 'color: red']})
<style type="text/css" >
#T_fda50_row0_col0{
background-color: black;
color: red;
background-color: black;
color: red;
}</style>
defaultdict(<class 'list'>, {(0, 0): ['background-color: black', 'color: red', 'background-color: black', 'color: red']})
Problem description
The private _todo
list is not cleared after initial execution so repeats the execution on second render.
There does not seem to be any reason any reason to maintain the _todo
list after it has been done and the ctx
object has been updated with necessary css-styles.
Expected Output
Same on each render.