Skip to content

Conversation

@natmokval
Copy link
Contributor

Building the documentation passes locally.

Copy link
Member

@MarcoGorelli MarcoGorelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @natmokval ! This does indeed fix that cell, but it looks like the notebook still doesn't execute, as there's a cell which uses the (now removed) hide_index:

# Hide the construction of the display chart from the user import pandas as pd from IPython.display import HTML # Test series test1 = pd.Series([-100,-60,-30,-20], name='All Negative') test2 = pd.Series([-10,-5,0,90], name='Both Pos and Neg') test3 = pd.Series([10,20,50,100], name='All Positive') test4 = pd.Series([100, 103, 101, 102], name='Large Positive') head = """ <table>  <thead>  <th>Align</th>  <th>All Negative</th>  <th>Both Neg and Pos</th>  <th>All Positive</th>  <th>Large Positive</th>  </thead>  </tbody>  """ aligns = ['left', 'right', 'zero', 'mid', 'mean', 99] for align in aligns: row = "<tr><th>{}</th>".format(align) for series in [test1,test2,test3, test4]: s = series.copy() s.name='' row += "<td>{}</td>".format(s.to_frame().style.hide_index ().bar(align=align, color=['#d65f5f', '#5fba7d'], width=100).to_html()) #testn['width'] row += '</tr>' head += row head+= """ </tbody> </table>"""

I'm surprised this didn't fail CI - if you want, how about we add some check (either here, or in a separate pull request) like

jupyter nbconvert --execute doc/source/user_guide/style.ipynb --to notebook 

somewhere? Perhaps inside https://github.com/pandas-dev/pandas/blob/main/ci/code_checks.sh
Then CI would tell us if it doesn't execute again

@natmokval
Copy link
Contributor Author

Thanks, @MarcoGorelli. I fixed the problem with hide_index() and added a new commit for that. Now the notebook executes without errors.

I wanted to add the command jupyter nbconvert --execute doc/source/user_guide/style.ipynb --to notebook in code_checks.sh, but didn't find a suitable place for it. Checking notebook compilation doesn't seem to be doctests or single-docs. Could you advise me? Maybe we can check for failure during the documentation building process (python make.py)?

@MarcoGorelli
Copy link
Member

Sure - I think a new notebooks section would be good. It should be fine for it to just run jupyter nbconvert --execute doc/source/user_guide/style.ipynb --to notebook, and that should already exit 1 if it fails and 0 if it succeeds

I haven't tried it, but something like jupyter nbconvert --execute $(find -name '*.ipynb') --to notebook might work

Anyway, that'd be for a separate PR, thanks for your contribution here!

@MarcoGorelli MarcoGorelli added the Styler conditional formatting using DataFrame.style label Nov 27, 2022
@MarcoGorelli MarcoGorelli added this to the 2.0 milestone Nov 27, 2022
Copy link
Member

@MarcoGorelli MarcoGorelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MarcoGorelli MarcoGorelli merged commit 094b2c0 into pandas-dev:main Nov 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Styler conditional formatting using DataFrame.style

2 participants