Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/benchmarktool/result/xlsx_gen/plot_sheets/helper_sheet.py
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,10 @@ def finalize(self) -> None:
col += 1
self.start_cols[sheet] = col
for setting in range(self.setting_n):
# pre-create all columns of the current table block with object dtype.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have to admit that I do not have the slightest idea what kind of columns are created here. The number 4 seems a bit of a magic number to me. The typical guideline would be to such constants a descriptive name.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are the columns for index, sorted, index and aggregated.
I write your comment down for the future.

for block_col in range(col, col + 4):
if block_col not in self.content.columns:
self.content[block_col] = None
# setting refs
self._add_setting_headers(
sheet_ref=sheet_ref,
Expand Down
32 changes: 16 additions & 16 deletions tests/result/xlsx_gen/test_helper_sheet.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,14 +439,14 @@ def test_finalize(self):

self.assertDictEqual(self.sheet.float_occur, {"time": [1, 3], "timeout": [2, 4]})
self.assertEqual(self.sheet.setting_n, 2)
pd.testing.assert_frame_equal(
self.sheet.content,
pd.DataFrame(
{
0: pd.Series([None, "time", "timeout"], dtype=object),
1: pd.Series([None, 1.0, 2.0], dtype=object),
},
),
pd.testing.assert_series_equal(
self.sheet.content[0],
pd.Series([None, "time", "timeout"], dtype=object, name=0),
check_dtype=False,
)
pd.testing.assert_series_equal(
self.sheet.content[1],
pd.Series([None, 1.0, 2.0], dtype=object, name=1),
check_dtype=False,
)

Expand Down Expand Up @@ -478,14 +478,14 @@ def test_finalize(self):

self.assertDictEqual(self.sheet.float_occur, {"time": [1], "timeout": [2]})
self.assertEqual(self.sheet.setting_n, 1)
pd.testing.assert_frame_equal(
self.sheet.content,
pd.DataFrame(
{
0: pd.Series([None, "time", "timeout"], dtype=object),
1: pd.Series([None, 1.0, 2.0], dtype=object),
},
),
pd.testing.assert_series_equal(
self.sheet.content[0],
pd.Series([None, "time", "timeout"], dtype=object, name=0),
check_dtype=False,
)
pd.testing.assert_series_equal(
self.sheet.content[1],
pd.Series([None, 1.0, 2.0], dtype=object, name=1),
check_dtype=False,
)

Expand Down
Loading