@@ -987,11 +987,11 @@ def to_latex(
987
987
hide the repeated level-0 of the index:
988
988
989
989
>>> (styler.format(subset="Equity", precision=2)
990
- ... .format(subset="Stats", precision=1, thousands=",")
991
- ... .format(subset="Rating", formatter=str.upper)
992
- ... .format_index(escape="latex", axis=1)
993
- ... .format_index(escape="latex", axis=0)
994
- ... .hide(level=0, axis=0)) # doctest: +SKIP
990
+ ... .format(subset="Stats", precision=1, thousands=",")
991
+ ... .format(subset="Rating", formatter=str.upper)
992
+ ... .format_index(escape="latex", axis=1)
993
+ ... .format_index(escape="latex", axis=0)
994
+ ... .hide(level=0, axis=0)) # doctest: +SKIP
995
995
996
996
Note that one of the string entries of the index and column headers is "H&M".
997
997
Without applying the `escape="latex"` option to the `format_index` method the
@@ -1003,12 +1003,15 @@ def to_latex(
1003
1003
recommendation:
1004
1004
1005
1005
>>> def rating_color(v):
1006
- ... if v == "Buy": color = "#33ff85"
1007
- ... elif v == "Sell": color = "#ff5933"
1008
- ... else: color = "#ffdd33"
1006
+ ... if v == "Buy":
1007
+ ... color = "#33ff85"
1008
+ ... elif v == "Sell":
1009
+ ... color = "#ff5933"
1010
+ ... else:
1011
+ ... color = "#ffdd33"
1009
1012
... return f"color: {color}; font-weight: bold;"
1010
1013
>>> (styler.background_gradient(cmap="inferno", subset="Equity", vmin=0, vmax=1)
1011
- ... .map(rating_color, subset="Rating")) # doctest: +SKIP
1014
+ ... .map(rating_color, subset="Rating")) # doctest: +SKIP
1012
1015
1013
1016
All the above styles will work with HTML (see below) and LaTeX upon conversion:
1014
1017
0 commit comments