Skip to content

Commit

Permalink
changes to support pandas>2
Browse files Browse the repository at this point in the history
  • Loading branch information
rpreen committed Oct 17, 2024
1 parent 9cf620d commit 9dc7622
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions acro/acro_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -1512,6 +1512,9 @@ def crosstab_with_totals( # pylint: disable=too-many-arguments,too-many-locals
normalize=normalize,
)

if table.empty:
raise ValueError("empty table")

table, _ = delete_empty_rows_columns(table)
masks = create_crosstab_masks(
index_new,
Expand Down
7 changes: 6 additions & 1 deletion test/test_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,12 @@ def test_finalise_json(data, acro):
assert orig.summary == read.summary
assert orig.comments == read.comments
assert orig.timestamp == read.timestamp
assert (orig.output[0].reset_index()).equals(read.output[0])
# check SDC outcome DataFrame
orig_df = orig.output[0].reset_index()
read_df = read.output[0]
pd.testing.assert_frame_equal(
orig_df, read_df, check_names=False, check_dtype=False
)
# test reading JSON
with open(os.path.normpath(f"{PATH}/results.json"), encoding="utf-8") as file:
json_data = json.load(file)
Expand Down

0 comments on commit 9dc7622

Please sign in to comment.