6

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()
1

2 Answers 2

9

Use this

from IPython.display import HTML

HTML(filename="profiling/z2pDecisionTreeProfiling.html")
Sign up to request clarification or add additional context in comments.

Comments

7

You need to invoke IPython's HTML function:

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.