-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
022fd8f
commit 0b0dcf8
Showing
2 changed files
with
36 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,42 @@ | ||
""" | ||
Logger function for ydata-profiling reports | ||
""" | ||
from __future__ import absolute_import, division, print_function | ||
|
||
import logging | ||
|
||
import pandas as pd | ||
|
||
from ydata_profiling.utils.common import analytics_features | ||
|
||
|
||
class ProfilingLogger(logging.Logger): | ||
def __init__(self, name, level=logging.INFO): | ||
super().__init__(name, level) | ||
|
||
def info( | ||
self, | ||
msg: object, | ||
) -> None: | ||
super().info(f'[PROFILING] - {msg}.') | ||
self, | ||
msg: object, | ||
) -> None: | ||
super().info(f"[PROFILING] - {msg}.") | ||
|
||
def info_def_report(self, dataframe, timeseries: bool): | ||
if dataframe == pd.DataFrame: | ||
dataframe = 'pandas' | ||
report_type = 'regular' | ||
dataframe = "pandas" | ||
report_type = "regular" | ||
elif dataframe == type(None): | ||
dataframe = 'pandas' | ||
report_type='compare' | ||
dataframe = "pandas" | ||
report_type = "compare" | ||
else: | ||
dataframe = 'spark' | ||
report_type = 'regular' | ||
dataframe = "spark" | ||
report_type = "regular" | ||
|
||
datatype='timeseries' if timeseries else 'tabular' | ||
datatype = "timeseries" if timeseries else "tabular" | ||
|
||
analytics_features(dataframe=dataframe, | ||
datatype=datatype, | ||
report_type=report_type) | ||
analytics_features( | ||
dataframe=dataframe, datatype=datatype, report_type=report_type | ||
) | ||
|
||
super().info(f'[PROFILING] Calculating profile with the following characteristics ' | ||
f'- {dataframe} | {datatype} | {report_type}.') | ||
super().info( | ||
f"[PROFILING] Calculating profile with the following characteristics " | ||
f"- {dataframe} | {datatype} | {report_type}." | ||
) |