Can't display pandas_profiling report

I’m exploring Panel, and I would like to display the pandas_profiling HTML report in the server using panel, it works good in the notebook but unfortunately, it shows nothing when applying show() function!
Could you guide me, please?

The to_notebook_iframe does not actually return anything it uses the IPython display function to display the output in the notebook. Try modifying your function to:

def generate_report(data):
    return pn.pane.HTML(profil.to_html())
1 Like

Hi @Ouma

I tried it out and @philippjfr suggestion works but it will show the Pandas Profiling Report Menu Bar in the top of your app.

If you don’t want that you can embed the html report in an iframe. The key is something like

html_report = html.escape(self.html_report)
self.html_report_pane.object = (
    f"""<iframe srcdoc="{html_report}" frameborder="0" allowfullscreen></iframe>"""

and some css

iframe {

You can find a live example and code at

1 Like

Thank you @Marc, this solves my problem. I tried it out in Jupyter notebook and It works perfectly, however, I can’t lunch the server from the command line using " panel serve", it takes about 30 minutes and it still running without showing outputs.

panel serve does not open a window automatically. You can either visit the address where it’s running manually, i.e. go to http://localhost:5006/pandas_profiling_app in your browser or append --show to the panel serve command which will attempt to open a browser automatically.

1 Like

Unfortunately, the methods show an empty browser! Should I adjust something for bokeh server?

Can you post the full contents of or at least the parts related to Panel otherwise it’s hard to determine the cause?

I just tested @Marc’s code, here is the file:

Hi @Ouma

As shown you should be able run the code with panel serve assuming you are running the latest versions of Panel (>= 0.9.5) and Bokeh (>= 2.0.2).

For me (on a powerful laptop) it takes 47secs from starting on the command line to having the full report displayed in the browser.

If you are on older versions of Bokeh try changing

if __name__.startswith("bokeh"):
    pn.config.sizing_mode = "stretch_width"


pn.config.sizing_mode = "stretch_width"
1 Like

Thank you upgrading bokeh version solves the problem.
@Marc When I tried to generate the Pandas Profiling Report using the output “profil.to_html()” and the method of iframe you showed me:

the report is displayed as a follow:
I missed something?

Yes @Ouma

Try setting the width to 100% and height to 800px via the style attribute on the iframe.

1 Like

It shows the resport Menu Bar :confused:

If it’s the pandas profiling menu bar you want to remove, you will have to take a look at the pandas profiling documentation to figure out how.

It can be done.

No,I meant by “Menu Bar” that it’s not displayed properly, just like the first case we’ve tested with pn.pane.HTML(profil.to_html()) .I want it to be displayed on the whole window, just like this:

using the output “profil.to_html()”

@Ouma. Then it looks like you did not set the width of the iframe to 100%.

Or alternatively the sizing_mode of the HTML pane to stretch_width.

Thank you @Marc, I set already iframe to 100% but it doesn’t work, however stretch_width solves the problem :slight_smile:

1 Like