Use of pn.panel.HTML overwrites jupyterlab top bar

You made it before me @philippjfr . Would you accept PRs for other kinds of Auto Generated Data Reports? For example Lux?

My take on a solution would be this one.

pandas-profile-report2-speedup

import html

import pandas as pd
import panel as pn
from pandas_profiling import ProfileReport

pn.extension(sizing_mode="stretch_width", template="fast")


ACCENT_COLOR = "#FAAA8D"

def to_pandas_profile_pane(profile: ProfileReport, height=700, **params) -> pn.pane.HTML:
    profile_html = profile.to_html()
    html_report = html.escape(profile_html)
    return pn.pane.HTML(
        f"""<iframe style="width: 100%; height: {height}px; overflow: auto;" frameborder=0 srcdoc="{html_report}"></iframe>""",
        **params,
    )

if not "profile" in pn.state.cache:
    data = pd.read_csv(
        "https://raw.githubusercontent.com/MarcSkovMadsen/awesome-panel/master/application/pages/awesome_panel_express_tests/PerspectiveViewerData.csv"
    )
    profile = pn.state.cache["profile"] = ProfileReport(data, title="title", minimal=False)
else:
    profile = pn.state.cache["profile"]

to_pandas_profile_pane(profile).servable()

pn.state.template.param.update(
    site="Awesome Panel",
    title="Pandas Profile Report",
    accent_base_color=ACCENT_COLOR,
    header_background=ACCENT_COLOR,
)
2 Likes