is there a way to apply StyleFrame on individual cells rather than using some conditional statements to style the entire row.
Asked
Active
Viewed 667 times
0
-
Kindly refer to [this](https://pandas.pydata.org/pandas-docs/stable/user_guide/style.html#Precision). – r-beginners Jan 25 '21 at 11:50
1 Answers
0
Yes, but it is not straightforward.
You can abuse the fact that apply_style_by_indexes
accepts a cols_to_style
argument (see the docs), and the fact that you can pass an index directly:
sf = StyleFrame({'a': [1, 2, 3], 'b': [4, 5, 6], 'c': [7, 8, 9]})
sf.apply_style_by_indexes(sf.index[1], Styler(bg_color='yellow'), cols_to_style='b')
This will only style the cell that contains 5
because it is the "intersection" of sf.index[1]
and the b
column.

DeepSpace
- 78,697
- 11
- 109
- 154