fbdesignpro / sweetviz

Visualize and compare datasets, target values and associations, with one line of code.
MIT License
2.9k stars 273 forks source link

Return generated HTML from the function show_html() in the ReportDataFrame class #168

Open DiptenduIDEAS opened 7 months ago

DiptenduIDEAS commented 7 months ago

The function show_html() is generating HTML and writing it to a file. It does not return any data. It would be useful if it return the generated HTML as a string so that it may be easily integrated with other libraries, for example Streamlit

report = sv.analyze(data)
svhtml = report.show_html(...)
streamlit.components.v1.html(svhtml)
fbdesignpro commented 6 months ago

@DiptenduIDEAS thank you for the report! Apologies for the long delay in answering, things have been crazy busy over here.

Good news: after the generation, the report is available through the report's _page_html variable. It's not pretty, but it works. I'll make a note of making it returned outright for better accessibility. In the meantime, the following should work:

report = sv.analyze(data)

report.show_html(...)
svhtml = report._page_html

streamlit.components.v1.html(svhtml)

Let me know that works, and if you run into any issues! Thanks again!