@@ -646,21 +646,22 @@ def format(
646
646
Using ``na_rep`` and ``precision`` with the default ``formatter``
647
647
648
648
>>> df = pd.DataFrame([[np.nan, 1.0, 'A'], [2.0, np.nan, 3.0]])
649
- >>> df.style.format(na_rep='MISS', precision=3)
649
+ >>> df.style.format(na_rep='MISS', precision=3) # doctest: +SKIP
650
650
0 1 2
651
651
0 MISS 1.000 A
652
652
1 2.000 MISS 3.000
653
653
654
654
Using a ``formatter`` specification on consistent column dtypes
655
655
656
- >>> df.style.format('{:.2f}', na_rep='MISS', subset=[0,1])
656
+ >>> df.style.format('{:.2f}', na_rep='MISS', subset=[0,1]) # doctest: +SKIP
657
657
0 1 2
658
658
0 MISS 1.00 A
659
659
1 2.00 MISS 3.000000
660
660
661
661
Using the default ``formatter`` for unspecified columns
662
662
663
663
>>> df.style.format({0: '{:.2f}', 1: '£ {:.1f}'}, na_rep='MISS', precision=1)
664
+ ... # doctest: +SKIP
664
665
0 1 2
665
666
0 MISS £ 1.0 A
666
667
1 2.00 MISS 3.0
@@ -669,7 +670,7 @@ def format(
669
670
``formatter``.
670
671
671
672
>>> df.style.format(na_rep='MISS', precision=1, subset=[0])
672
- ... .format(na_rep='PASS', precision=2, subset=[1, 2])
673
+ ... .format(na_rep='PASS', precision=2, subset=[1, 2]) # doctest: +SKIP
673
674
0 1 2
674
675
0 MISS 1.00 A
675
676
1 2.0 PASS 3.00
@@ -678,6 +679,7 @@ def format(
678
679
679
680
>>> func = lambda s: 'STRING' if isinstance(s, str) else 'FLOAT'
680
681
>>> df.style.format({0: '{:.1f}', 2: func}, precision=4, na_rep='MISS')
682
+ ... # doctest: +SKIP
681
683
0 1 2
682
684
0 MISS 1.0000 STRING
683
685
1 2.0 MISS FLOAT
@@ -688,7 +690,7 @@ def format(
688
690
>>> s = df.style.format(
689
691
... '<a href="a.com/{0}">{0}</a>', escape="html", na_rep="NA"
690
692
... )
691
- >>> s.render()
693
+ >>> s.render() # doctest: +SKIP
692
694
...
693
695
<td .. ><a href="a.com/<div></div>"><div></div></a></td>
694
696
<td .. ><a href="a.com/"A&B"">"A&B"</a></td>
@@ -698,7 +700,8 @@ def format(
698
700
Using a ``formatter`` with LaTeX ``escape``.
699
701
700
702
>>> df = pd.DataFrame([["123"], ["~ ^"], ["$%#"]])
701
- >>> s = df.style.format("\\textbf{{{}}}", escape="latex").to_latex()
703
+ >>> df.style.format("\\textbf{{{}}}", escape="latex").to_latex()
704
+ ... # doctest: +SKIP
702
705
\begin{tabular}{ll}
703
706
{} & {0} \\
704
707
0 & \textbf{123} \\
0 commit comments