You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
Styler is a different object to the rest of pandas, its methods affect the visual output of browsers and other renderers.
These docstrings were created as a balance between helping the user and being able to read the code as a developer.
Adding images has the disadvantage of being more difficult for developers to edit, but being visually accurate.
The doc test as is has the advantages of being editable by devs and visible to users, but the disadvantage of failing a doc test.
The soultion here, as is with many styler doc tests is to skip it.
Fix the following doctest in style_render.py file:
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.The text was updated successfully, but these errors were encountered: