from awesome_panel_extensions.awesome_panel.notebook import Header
Header(notebook="PandasProfileReport.ipynb", folder="examples/reference/panes")
The PandasProfileReport
pane enables a user to embed a ProfileReport
generated using the
Pandas profile_report package in apps developed in Python and
Panel.
object
(pandas_profiling.ProfileReport): The Pandas Profiling ProfileReport objectobject_when_no_report
(str): A HTML element to show when the object
is None
object_when_loading_report
(str): A HTML element to shown while generating the HTML report.The PandasProfileReport
has the same layout and styling parameters as Column
. For example height
, width
and sizing_mode
.
Let's start by importing the dependencies
import panel as pn
pn.extension()
pn.config.sizing_mode = "stretch_width"
import pandas as pd
from pandas_profiling import ProfileReport
from awesome_panel_extensions.pane import PandasProfileReport
Then we generate the ProfileReport
URL = "http://eforexcel.com/wp/wp-content/uploads/2017/07/100-Sales-Records.zip"
DATAFRAME = pd.read_csv(URL)
profile_report = ProfileReport(DATAFRAME)
If you wan't to customize the profile_report
you can take a look at the available options here.
Then we wrap the profile_report
in a PandasProfileReport
pane.
pandas_profile_report = PandasProfileReport(profile_report=profile_report, height=700)
HBox(children=(FloatProgress(value=0.0, description='Summarize dataset', max=28.0, style=ProgressStyle(descrip…
HBox(children=(FloatProgress(value=0.0, description='Generate report structure', max=1.0, style=ProgressStyle(…
c:\repos\private\panel-extensions-template\.venv\lib\site-packages\pandas_profiling\visualisation\plot.py:154: MatplotlibDeprecationWarning: You are modifying the state of a globally registered colormap. In future versions, you will not be able to modify a registered colormap in-place. To remove this warning, you can make a copy of the colormap first. cmap = copy.copy(mpl.cm.get_cmap("RdBu")) cmap.set_bad(cmap_bad)
HBox(children=(FloatProgress(value=0.0, description='Render HTML', max=1.0, style=ProgressStyle(description_wi…
Finally we wrap it all together in an app
that allows testing the pane
app_bar = pn.pane.Markdown(
"# Pandas Profiling powered by Panel 💪",
background="black",
style={"color": "white", "padding-left": "25px", "padding-bottom": "0px"},
)
app_settings = pn.WidgetBox(
pn.Param(
pandas_profile_report,
parameters=["height", "width", "sizing_mode", "object_when_no_report", "object_when_loading_report"],
show_name=False
),
sizing_mode="fixed",
)
app=pn.Column(app_bar, pn.Row(pandas_profile_report, app_settings))
app.servable()
You can run the app as a web app by running panel serve PandasProfileReport.ipynb
from the command line.
If you want to see a live app using the Pandas Profiling Report you can find one in the Gallery at awesome-panel.org
If you think the PandasProfileReport
is awesome please share it on Twitter.