I have a webserver that displays tables of data with some formatting. The formatting is colouring certain cells. The tables are stored as dataframes and the formatting is applied using a pandas styler.
The issue is for large tables, ~3000 rows, some of the cells are not being coloured, particularly ones far down near the end of the table. I downloaded the styled dataframe as an excel sheet and the colouring was correct so I know my colouring function is correct.
When I produced a table of ~5000 rows, I noticed that the styling ends abruptly at row 4096.
I think that because of the way pandas is generating the style function, web-browsers can't handle the recursive depth. Since it puts all the tags on a single CSS element like so:
#T_394319f6_5c20_11eb_832b_04ed338ce712row0_col6,#T_394319f6_5c20_11eb_832b_04ed338ce712row0_col7,
...
#T_394319f6_5c20_11eb_832b_04ed338ce712row1_col6 { background-colour: red }
What can I do?
EDIT:
Temporary solution is to colour with a random shade of the color, so I selected multiple shades of possible red for the background that are randomly selected. This "works" but is quite hacky.
question from:
https://stackoverflow.com/questions/65834907/pandas-styler-css-limit-reached 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…