#!/usr/bin/env python # coding: utf-8 # In[1]: from awesome_panel_extensions.awesome_panel.notebook import Header Header(notebook="PandasProfileReport.ipynb", folder="examples/reference/panes") # # PandasProfileReport - Reference Guide # # The `PandasProfileReport` pane enables a user to embed a `ProfileReport` generated using the # [Pandas profile_report](https://github.com/pandas-profiling/pandas-profiling) package in apps developed in [Python](https://www.python.org/) and # [Panel](https://panel.holoviz.org). # # # # #
# # # #
# # # #### Parameters: # # * **``object``** (pandas_profiling.ProfileReport): The Pandas Profiling ProfileReport object # * **``object_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 # In[2]: 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` # In[3]: 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](https://pandas-profiling.github.io/pandas-profiling/docs/master/rtd/pages/advanced_usage.html). # # Then we wrap the `profile_report` in a `PandasProfileReport` pane. # In[4]: pandas_profile_report = PandasProfileReport(profile_report=profile_report, height=700) # Finally we wrap it all together in an `app` that allows testing the pane # In[5]: 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](awesome-panel.org) # # ## Share # # If you think the `PandasProfileReport` is awesome please share it on Twitter.