Closed
Description
Fix the following doctest in style_render.py file:
pandas/io/formats/style_render.py F
=================================== FAILURES ===================================
________ [doctest] pandas.io.formats.style_render.StylerRenderer.format ________
647
648 >>> df = pd.DataFrame([[np.nan, 1.0, 'A'], [2.0, np.nan, 3.0]])
649 >>> df.style.format(na_rep='MISS', precision=3) # doctest: +SKIP
650 0 1 2
651 0 MISS 1.000 A
652 1 2.000 MISS 3.000
653
654 Using a ``formatter`` specification on consistent column dtypes
655
656 >>> df.style.format('{:.2f}', na_rep='MISS', subset=[0,1])
Expected:
0 1 2
0 MISS 1.00 A
1 2.00 MISS 3.000000
Got:
<pandas.io.formats.style.Styler object at 0x7f77b214ea30>
/home/aneesh/Desktop/Side Projects/ops/pandas/pandas/io/formats/style_render.py:656: DocTestFailure
- generated xml file: /home/aneesh/Desktop/Side Projects/ops/pandas/test-data.xml -
============================= slowest 30 durations =============================
1.14s call pandas/io/formats/style_render.py::pandas.io.formats.style_render.StylerRenderer.format
(2 durations < 0.005s hidden. Use -vv to show these durations.)
=========================== short test summary info ============================
FAILED pandas/io/formats/style_render.py::pandas.io.formats.style_render.StylerRenderer.format
============================== 1 failed in 1.70s ===============================
OBSERVATION
The mentioned test returns a Styler object which will render properly in (for instance, a notebook), but will fail the doctest as it will simply return the object.
SOLUTION
Add images of output rendered, in the doctest wherever required. (The approach is mentioned #42674 (comment), for the documentation of background_gradient()) or add a # doctest: +SKIP
if necessary.