sparrow
sparrow

Reputation: 11460

Show output of .html file in Jupyter notebooks

I can create an html file using this code:

with open(file_loc+'file.html', 'w') as html:
    html.write(s.set_table_attributes("border=1").render())

How can I show the output in Jupyter Notebooks without creating the file?

If I simply try to render it in Jupyter (shown below) then it shows the html code instead of displaying the desired output that I would see in my browser:

from IPython.core.display import display, HTML
s.set_table_attributes("border=1").render()

Upvotes: 6

Views: 22809

Answers (2)

Ankit Kumar Rajpoot
Ankit Kumar Rajpoot

Reputation: 5590

Use this

from IPython.display import HTML

HTML(filename="profiling/z2pDecisionTreeProfiling.html")

Upvotes: 9

eduffy
eduffy

Reputation: 40214

You need to invoke IPython's HTML function:

 HTML(s.set_table_attributes("border=1").render())

Upvotes: 7

Related Questions