Displaying HTML Output
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-08-2018 10:52 AM
I am trying to display the html output or read in an html file to display in databricks notebook from pandas-profiling.
import pandas as pd import pandas_profiling
df = pd.read_csv("/dbfs/FileStore/tables/my_data.csv", header='infer', parse_dates=True, encoding='UTF-8')
profile = pandas_profiling.ProfileReport(df) Out[13]: <pandas_profiling.ProfileReport at 0x7f30e0b55780>
profile.to_html() Out[19]: '<!doctype html>\n\n<html lang="en">\n<head>\n <meta charset="utf-8">\n\n <title>Profile report</title>... WARNING: skipped 429584 bytes of output
Error on dislpayHtml()
displayHTML(profile)Py4JException: An exception was raised by the Python Proxy. Return Message: x
I could also output to html file:
profile.to_file(outputfile="/tmp/my_profiling.html")
but how would I read that in? is there a %html command?
- Labels:
-
Display
-
Displayhtml
-
Html
-
Notebooks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-08-2018 10:59 AM
I am sorry it is a mess, the code formatting on here does not escape the code I tried to embed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2019 03:20 AM
Hi,
Took me a while to find a simple solution. Found two ways. Hope they work.
1.
- Read the html file content
html_file_content = open("output.html", 'r').read()
- Use displayHTML on the html_file_content
displayHTML(html_file_content)
2. Note: df is the dataframe
profile = pp.ProfileReport(df)
p = profile.to_html()
displayHTML(p)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2019 02:36 AM
Have you tried using
displayHTML(profile.to_html())
It worked for me, but I didn't have the warning or Exception, you had, when I used
displayHTML(profile)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2019 05:06 PM
What eventually worked for me was displayHTML(profile.to_html()) for the pandas_profiling and displayHTML(profile.html) for the spark_profiling.

