pythonjupyterjupyterhub

Remove warning in JupyterHub when using display and HTML for iframe


I'm using JupyterHub and to show data I'm using an IFrame object from the IPython.display package. Even though the data is showing correctly, I'm getting warning messages about the deprecated method:

/tmp/ipykernel_8683/279239772.py:8: FutureWarning: this method is deprecated in favour of Styler.hide(axis='index') counts[['ani','size']].sort_values(by=['size'], ascending=False).style.hide_index().render() + /tmp/ipykernel_8683/279239772.py:8: FutureWarning: this method is deprecated in favour of Styler.to_html() counts[['ani','size']].sort_values(by=['size'], ascending=False).style.hide_index().render() +

I'm using this to display my data:

display(HTML("<div style='height: 200px; overflow: auto; width: fit-content'>" +
             counts[['ani','size']].sort_values(by=['size'], ascending=False).style.hide_index().render() +
             "</div>"))

Is there a way to remove those warnings?


Solution

  • Have you tried putting these three lines as a code cell early in your notebook so that you are runnning that ahead of the cells causing the issue:

    import warnings
    warnings.filterwarnings('ignore')
    warnings.simplefilter('ignore')
    

    Also see: