Skip to content

Commit

Permalink
StatsFrame change name to a column index, not column (LLNL#67)
Browse files Browse the repository at this point in the history
* Fix name level in statsframe and add new unit test

* Add comment

* black
  • Loading branch information
michaelmckinsey1 authored Jul 20, 2023
1 parent 48b930c commit 6b2107d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion thicket/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def _new_statsframe_df(df, multiindex=False):

# Create MultiIndex structure if necessary.
if multiindex:
new_df.columns = pd.MultiIndex.from_tuples([("", "name")])
new_df.columns = pd.MultiIndex.from_tuples([("name", "")])

return new_df

Expand Down
13 changes: 12 additions & 1 deletion thicket/tests/test_thicket.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,18 @@ def test_sync_nodes(example_cali):
assert helpers._are_synced(th.graph, th.dataframe)


def test_aggregated_statistics_table(example_cali):
def test_statsframe(example_cali):
def _test_multiindex():
"""Test statsframe when headers are multiindexed."""
th1 = Thicket.from_caliperreader(example_cali[0])
th2 = Thicket.from_caliperreader(example_cali[1])
th_cj = Thicket.columnar_join([th1, th2])

# Check column format
assert ("name", "") in th_cj.statsframe.dataframe.columns

_test_multiindex()

th = Thicket.from_caliperreader(example_cali[-1])

# Arbitrary value insertion in aggregated statistics table.
Expand Down

0 comments on commit 6b2107d

Please sign in to comment.