Skip to content

Commit

Permalink
fix: handle text as categoricals if sensitive=True (#1415)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbarros authored Aug 7, 2023
1 parent 53dd27c commit 346478c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -339,10 +339,14 @@ def render_categorical(config: Settings, summary: dict) -> dict:

template_variables = render_common(config, summary)

type_name = summary["type"]
if isinstance(type_name, list):
type_name = type_name[0]

info = VariableInfo(
summary["varid"],
summary["varname"],
"Categorical",
type_name,
summary["alerts"],
summary["description"],
style=config.html.style,
Expand Down
5 changes: 5 additions & 0 deletions src/ydata_profiling/report/structure/variables/render_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from ydata_profiling.report.structure.variables.render_categorical import (
_get_n,
freq_table,
render_categorical,
render_categorical_frequency,
render_categorical_length,
render_categorical_unicode,
Expand All @@ -21,6 +22,10 @@


def render_text(config: Settings, summary: Dict[str, Any]) -> Dict[str, Any]:
if config.vars.text.redact:
render = render_categorical(config, summary)
return render

varid = summary["varid"]
words = config.vars.text.words
characters = config.vars.text.characters
Expand Down

0 comments on commit 346478c

Please sign in to comment.