def render(self): styles = { "constant": "warning", "unsupported": "warning", "type_date": "warning", "high_cardinality": "danger", "unique": "danger", "uniform": "danger", "infinite": "info", "zeros": "info", "truncated": "info", "missing": "info", "skewed": "info", "high_correlation": "", "duplicates": "", } items = [] for message in self.content["warnings"]: type_name = message.message_type.name.lower() if type_name == "rejected": continue items.append( HTML( templates.template(f"warnings/warning_{type_name}.html"). render(message=message))) items.append( Button( description=type_name.replace("_", " ").capitalize(), button_style=styles[type_name], disabled=True, )) return get_row(items)
def render(self, **kwargs): nav_items = [(section.name, section.anchor_id) for section in self.content["body"].content["items"]] return templates.template("report.html").render(**self.content, nav_items=nav_items, **kwargs)
def render(self): if self.sequence_type in ["list", "accordion"]: return templates.template("sequence/list.html").render( anchor_id=self.content["anchor_id"], items=self.content["items"]) elif self.sequence_type == "tabs": return templates.template("sequence/tabs.html").render( tabs=self.content["items"]) elif self.sequence_type == "sections": return templates.template("sequence/sections.html").render( sections=self.content["items"], full_width=config["html"]["style"]["full_width"].get(bool), ) elif self.sequence_type == "grid": return templates.template("sequence/grid.html").render( items=self.content["items"]) raise ValueError("Template not understood", self.sequence_type)
def render(self) -> str: styles = { "constant": "warning", "unsupported": "warning", "type_date": "warning", "constant_length": "primary", "high_cardinality": "primary", "unique": "primary", "uniform": "primary", "infinite": "info", "zeros": "info", "truncated": "info", "missing": "info", "skewed": "info", "high_correlation": "default", "duplicates": "default", } return templates.template("warnings.html").render(**self.content, styles=styles)
def to_html(self) -> str: """Generate and return complete template as lengthy string for using with frameworks. Returns: Profiling report html including wrapper. """ from pandas_profiling.report.presentation.flavours import HTMLReport from pandas_profiling.report.presentation.flavours.html import templates use_local_assets = config["html"]["use_local_assets"].get(bool) html = HTMLReport(self.report).render() nav_items = [ (section.name, section.anchor_id) for section in self.report.content["items"] ] # TODO: move to structure wrapped_html = templates.template("wrapper/wrapper.html").render( content=html, title=self.title, nav=config["html"]["navbar_show"].get(bool), nav_items=nav_items, version=__version__, offline=use_local_assets, primary_color=config["html"]["style"]["primary_color"].get(str), logo=config["html"]["style"]["logo"].get(str), theme=config["html"]["style"]["theme"].get(str), ) minify_html = config["html"]["minify_html"].get(bool) if minify_html: from htmlmin.main import minify wrapped_html = minify( wrapped_html, remove_all_empty_space=True, remove_comments=True ) return wrapped_html
def to_html(self) -> str: """Generate and return complete template as lengthy string for using with frameworks. Returns: Profiling report html including wrapper. """ from pandas_profiling.report.presentation.flavours import HTMLReport from pandas_profiling.report.presentation.flavours.html import templates use_local_assets = config["html"]["use_local_assets"].get(bool) html = HTMLReport(self.report).render() # TODO: move to structure wrapped_html = templates.template("wrapper/wrapper.html").render( content=html, title=self.title, correlation=len(self.description_set["correlations"]) > 0, missing=len(self.description_set["missing"]) > 0, scatter=len(self.description_set["scatter"]) > 0, sample=len(self.sample) > 0, version=__version__, offline=use_local_assets, primary_color=config["html"]["style"]["primary_color"].get(str), logo=config["html"]["style"]["logo"].get(str), theme=config["html"]["style"]["theme"].get(str), ) minify_html = config["html"]["minify_html"].get(bool) if minify_html: from htmlmin.main import minify wrapped_html = minify(wrapped_html, remove_all_empty_space=True, remove_comments=True) return wrapped_html
def render(self) -> str: if self.sequence_type in ["list", "accordion"]: return templates.template("sequence/list.html").render( anchor_id=self.content["anchor_id"], items=self.content["items"]) elif self.sequence_type == "named_list": return templates.template("sequence/named_list.html").render( anchor_id=self.content["anchor_id"], items=self.content["items"]) elif self.sequence_type == "tabs": return templates.template("sequence/tabs.html").render( tabs=self.content["items"], anchor_id=self.content["anchor_id"], nested=self.content["nested"], ) elif self.sequence_type == "select": return templates.template("sequence/select.html").render( tabs=self.content["items"], anchor_id=self.content["anchor_id"], nested=self.content["nested"], ) elif self.sequence_type == "sections": return templates.template("sequence/sections.html").render( sections=self.content["items"], full_width=self.content["full_width"], ) elif self.sequence_type == "grid": return templates.template("sequence/grid.html").render( items=self.content["items"]) elif self.sequence_type == "batch_grid": return templates.template("sequence/batch_grid.html").render( items=self.content["items"], batch_size=self.content["batch_size"], titles=self.content.get("titles", True), subtitles=self.content.get("subtitles", False), ) else: raise ValueError("Template not understood", self.sequence_type)
def render(self) -> widgets.HTML: return widgets.HTML( templates.template("variable_info.html").render(**self.content) )
def render(self): return widgets.HTML( templates.template("warnings.html").render(**self.content))
def render(self): return templates.template("frequency_table_small.html").render( **self.content)
def render(self): return templates.template("variable_info.html").render(**self.content)
def render(self): duplicate_html = self.content["duplicate"].to_html( classes="duplicate table table-striped") return templates.template("duplicate.html").render( **self.content, duplicate_html=duplicate_html)
def render(self): return templates.template("table.html").render(**self.content)
def render(self): return templates.template("toggle_button.html").render(**self.content)
def render(self) -> str: sample_html = self.content["sample"].to_html( classes="sample table table-striped") return templates.template("sample.html").render( **self.content, sample_html=sample_html)
def render(self): return widgets.HTML( templates.template("overview/overview.html").render( **self.content))
def render(self): return templates.template("warnings.html").render(**self.content)
def render(self): return templates.template("frequency_table.html").render( rows=self.content["rows"])
def render(self) -> str: return templates.template("frequency_table.html").render( **self.content)
def render(self) -> str: return templates.template("variable.html").render(**self.content)
def render(self): return templates.template("overview/overview.html").render( **self.content)
def render(self): return templates.template("diagram.html").render(**self.content)
def render(self) -> str: return templates.template("collapse.html").render(**self.content)