|
1 | 1 | import os |
2 | 2 | import inspect |
3 | 3 | import numpy as np |
4 | | -import pandas as pd |
5 | 4 | import plotly as py |
6 | | -import jinja2 |
7 | 5 | from os.path import dirname |
8 | 6 | from typing import List, Sequence, Dict, Union |
9 | | -from plotly.figure_factory import create_distplot |
| 7 | +from pandas import DataFrame |
10 | 8 | from plotly import express as px |
| 9 | +from plotly.figure_factory import create_distplot |
| 10 | +from jinja2 import Environment, FileSystemLoader |
11 | 11 |
|
12 | 12 | from .homogeneity_tests import ContinuousHomogeneityTests, DiscreteHomogeneityTests, fillna_cont, fillna_discr |
13 | 13 |
|
@@ -176,8 +176,8 @@ def config_dict(self, config_dict_inp: Dict) -> None: |
176 | 176 |
|
177 | 177 | def build_report( |
178 | 178 | self, |
179 | | - df1: pd.DataFrame, |
180 | | - df2: pd.DataFrame, |
| 179 | + df1: DataFrame, |
| 180 | + df2: DataFrame, |
181 | 181 | dropna: bool = False, |
182 | 182 | name1: str = 'Base subset', |
183 | 183 | name2: str = 'Current subset', |
@@ -218,9 +218,9 @@ def build_report( |
218 | 218 | """ |
219 | 219 |
|
220 | 220 | # checking error situations |
221 | | - if not isinstance(df1, pd.DataFrame): |
| 221 | + if not isinstance(df1, DataFrame): |
222 | 222 | raise TypeError("df1 must be a pandas DataFrame.") |
223 | | - if not isinstance(df2, pd.DataFrame): |
| 223 | + if not isinstance(df2, DataFrame): |
224 | 224 | raise TypeError("df2 must be a pandas DataFrame.") |
225 | 225 | features = self.features |
226 | 226 | if not (set(features) <= set(df1.columns)): |
@@ -368,7 +368,7 @@ def render_report(report_data: list, report_path: str = 'homogeneity_report.html |
368 | 368 | raise KeyError("Missing information in nan gap dict.") |
369 | 369 |
|
370 | 370 | # render report |
371 | | - env = jinja2.Environment(loader=jinja2.FileSystemLoader(curr_folder)) |
| 371 | + env = Environment(loader=FileSystemLoader(curr_folder)) |
372 | 372 | template = env.get_template("report_template.html") |
373 | 373 | output = template.render(sets=report_data) |
374 | 374 |
|
|
0 commit comments