Skip to content

Commit 1cf71c6

Browse files
alexbarrosaquemy
authored andcommitted
fix: handle text as categoricals if sensitive=True (#1415)
1 parent e6797bd commit 1cf71c6

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,10 +339,14 @@ def render_categorical(config: Settings, summary: dict) -> dict:
339339

340340
template_variables = render_common(config, summary)
341341

342+
type_name = summary["type"]
343+
if isinstance(type_name, list):
344+
type_name = type_name[0]
345+
342346
info = VariableInfo(
343347
summary["varid"],
344348
summary["varname"],
345-
"Categorical",
349+
type_name,
346350
summary["alerts"],
347351
summary["description"],
348352
style=config.html.style,

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from ydata_profiling.report.structure.variables.render_categorical import (
1313
_get_n,
1414
freq_table,
15+
render_categorical,
1516
render_categorical_frequency,
1617
render_categorical_length,
1718
render_categorical_unicode,
@@ -21,6 +22,10 @@
2122

2223

2324
def render_text(config: Settings, summary: Dict[str, Any]) -> Dict[str, Any]:
25+
if config.vars.text.redact:
26+
render = render_categorical(config, summary)
27+
return render
28+
2429
varid = summary["varid"]
2530
words = config.vars.text.words
2631
characters = config.vars.text.characters

0 commit comments

Comments
 (0)