From b9712d97d5025718bd39a1d74598a1d15623d387 Mon Sep 17 00:00:00 2001 From: Andrew <15331990+ahuang11@users.noreply.github.com> Date: Wed, 24 Jul 2024 07:40:23 -0700 Subject: [PATCH] Ydata profiling view (#613) Co-authored-by: Philipp Rudiger --- lumen/views/base.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/lumen/views/base.py b/lumen/views/base.py index 44bdba19e..679f11dad 100644 --- a/lumen/views/base.py +++ b/lumen/views/base.py @@ -1129,4 +1129,22 @@ def get_panel(self) -> pn.pane.Vega: return pn.pane.Vega(**self._normalize_params(self._get_params())) +class YdataProfilingView(View): + """ + A View that renders a ydata_profiling ProfileReport. + """ + + view_type = 'ydata_profiling' + + _panel_type = pn.pane.HTML + + def _get_params(self) -> Dict[str, Any]: + df = self.get_data() + return dict(df=df, **self.kwargs) + + def get_panel(self) -> pn.pane.HTML: + from ydata_profiling import ProfileReport + return self._panel_type(ProfileReport(**self._get_params()).html) + + __all__ = [name for name, obj in locals().items() if isinstance(obj, type) and issubclass(obj, View)] + ["Download"]