Skip to content

Commit

Permalink
Merge pull request #199 from AI-SDC/fixing_crosstab_suppression
Browse files Browse the repository at this point in the history
fixing suppression when margins is true
  • Loading branch information
mahaalbashir authored Mar 8, 2024
2 parents 2273a3a + bfa6696 commit 4aa84d6
Show file tree
Hide file tree
Showing 3 changed files with 509 additions and 401 deletions.
22 changes: 22 additions & 0 deletions acro/acro_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -1500,6 +1500,28 @@ def crosstab_with_totals( # pylint: disable=too-many-arguments,too-many-locals
dropna=dropna,
normalize=normalize,
)

table, _ = delete_empty_rows_columns(table)
masks = create_crosstab_masks(
index_new,
columns_new,
values,
rownames,
colnames,
aggfunc,
margins,
margins_name,
dropna,
normalize,
)

# Force the apply_suppression not to display the outcome dataframe
previous_level = logger.getEffectiveLevel()
logger.setLevel(logging.WARNING)
# apply the suppression
table, _ = apply_suppression(table, masks)
logger.setLevel(previous_level)

else:
table = pd.pivot_table( # type: ignore
data=data,
Expand Down
Loading

0 comments on commit 4aa84d6

Please sign in to comment.