Skip to content

Commit 3f15815

Browse files
PkchaPkcha
authored andcommitted
feat: initial release
1 parent 1e2fa10 commit 3f15815

3 files changed

Lines changed: 9 additions & 25 deletions

File tree

src/ydata_profiling/model/alerts.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
from ydata_profiling.utils.styles import get_alert_styles
1313

1414

15-
def fmt_percent(value: float, edge_cases: bool = True) -> str:
16-
"""Format a ratio as a percentage.
15+
def _fmt_percent(value: float, edge_cases: bool = True) -> str:
16+
"""Format a ratio as a percentage (internal copy to avoid circular imports).
1717
1818
Args:
1919
edge_cases: Check for edge cases?
@@ -209,7 +209,7 @@ def __init__(
209209

210210
def _get_description(self) -> str:
211211
if self.values is not None:
212-
return f"Dataset has {self.values['n_duplicates']} ({fmt_percent(self.values['p_duplicates'])}) duplicate rows"
212+
return f"Dataset has {self.values['n_duplicates']} ({_fmt_percent(self.values['p_duplicates'])}) duplicate rows"
213213
else:
214214
return "Dataset has no duplicated rows"
215215

@@ -231,7 +231,7 @@ def __init__(
231231

232232
def _get_description(self) -> str:
233233
if self.values is not None:
234-
return f"Dataset has {self.values['n_near_dups']} ({fmt_percent(self.values['p_near_dups'])}) near duplicate rows"
234+
return f"Dataset has {self.values['n_near_dups']} ({_fmt_percent(self.values['p_near_dups'])}) near duplicate rows"
235235
else:
236236
return "Dataset has no near duplicated rows"
237237

@@ -272,7 +272,7 @@ def __init__(
272272

273273
def _get_description(self) -> str:
274274
if self.values is not None:
275-
return f"[{self.column_name}] has {self.values['n_distinct']:} ({fmt_percent(self.values['p_distinct'])}) distinct values"
275+
return f"[{self.column_name}] has {self.values['n_distinct']:} ({_fmt_percent(self.values['p_distinct'])}) distinct values"
276276
else:
277277
return f"[{self.column_name}] has a high cardinality"
278278

@@ -294,7 +294,7 @@ def __init__(
294294

295295
def _get_description(self) -> str:
296296
if self.values is not None:
297-
return f"[{self.column_name}] has {self.values['n_fuzzy_vals']} fuzzy values: {fmt_percent(self.values['p_fuzzy_vals'])} per category"
297+
return f"[{self.column_name}] has {self.values['n_fuzzy_vals']} fuzzy values: {_fmt_percent(self.values['p_fuzzy_vals'])} per category"
298298
else:
299299
return f"[{self.column_name}] no dirty categories values."
300300

@@ -365,7 +365,7 @@ def __init__(
365365

366366
def _get_description(self) -> str:
367367
if self.values is not None:
368-
return f"[{self.column_name}] has {self.values['n_infinite']} ({fmt_percent(self.values['p_infinite'])}) infinite values"
368+
return f"[{self.column_name}] has {self.values['n_infinite']} ({_fmt_percent(self.values['p_infinite'])}) infinite values"
369369
else:
370370
return f"[{self.column_name}] has infinite values"
371371

@@ -387,7 +387,7 @@ def __init__(
387387

388388
def _get_description(self) -> str:
389389
if self.values is not None:
390-
return f"[{self.column_name}] {self.values['n_missing']} ({fmt_percent(self.values['p_missing'])}) missing values"
390+
return f"[{self.column_name}] {self.values['n_missing']} ({_fmt_percent(self.values['p_missing'])}) missing values"
391391
else:
392392
return f"[{self.column_name}] has missing values"
393393

@@ -541,7 +541,7 @@ def __init__(
541541

542542
def _get_description(self) -> str:
543543
if self.values is not None:
544-
return f"[{self.column_name}] has {self.values['n_zeros']} ({fmt_percent(self.values['p_zeros'])}) zeros"
544+
return f"[{self.column_name}] has {self.values['n_zeros']} ({_fmt_percent(self.values['p_zeros'])}) zeros"
545545
else:
546546
return f"[{self.column_name}] has predominantly zeros"
547547

src/ydata_profiling/model/summary_algorithms.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,6 @@
1111
T = TypeVar("T")
1212

1313

14-
def func_nullable_series_contains(fn: Callable) -> Callable:
15-
@functools.wraps(fn)
16-
def inner(
17-
config: Settings, series: pd.Series, state: dict, *args, **kwargs
18-
) -> bool:
19-
if series.hasnans:
20-
series = series.dropna()
21-
if series.empty:
22-
return False
23-
24-
return fn(config, series, state, *args, **kwargs)
25-
26-
return inner
27-
28-
2914
def safe_histogram(
3015
values: np.ndarray,
3116
bins: Union[int, str, np.ndarray] = "auto",

src/ydata_profiling/report/structure/variables/render_common.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ def render_common(config: Settings, summary: dict) -> dict:
1010
n_freq_table_max = config.n_freq_table_max
1111

1212
template_variables = {
13-
# TODO: with nan
1413
"freq_table_rows": freq_table(
1514
freqtable=summary["value_counts_without_nan"],
1615
n=summary["n"],

0 commit comments

Comments
 (0)