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
3 changes: 3 additions & 0 deletions thicket/tests/test_filter_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ def filter_one_column(th, columns_values):
# check if output is a thicket object
assert isinstance(new_th, Thicket)

# check filtered Thicket is separate object
assert th.graph is not new_th.graph

# metadata table: compare profile hash keys after filter to expected
metadata_profile = new_th.metadata.index.tolist()
assert metadata_profile == exp_index
Expand Down
4 changes: 4 additions & 0 deletions thicket/tests/test_filter_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ def check_filter_stats(th, columns_values):
# check if output is a thicket object
assert isinstance(new_th, Thicket)

# check filtered Thicket is separate object
# We can't check th.graph because of squash in filter_stats
assert th.statsframe.graph is not new_th.statsframe.graph

# filtered nodes in aggregated statistics table
stats_nodes = sorted(
new_th.statsframe.dataframe.index.drop_duplicates().tolist()
Expand Down
8 changes: 4 additions & 4 deletions thicket/thicket.py
Original file line number Diff line number Diff line change
Expand Up @@ -1090,8 +1090,8 @@ def filter_metadata(self, select_function):
# Get index name
index_name = self.metadata.index.name

# create a copy of the thicket object
new_thicket = self.copy()
# create a deepcopy of the thicket object
new_thicket = self.deepcopy()

# filter metadata table
filtered_rows = new_thicket.metadata.apply(select_function, axis=1)
Expand Down Expand Up @@ -1242,8 +1242,8 @@ def filter_stats(self, filter_function):
Returns:
(thicket): new thicket object with applied filter function
"""
# copy thicket
new_thicket = self.copy()
# deepcopy thicket
new_thicket = self.deepcopy()

# filter aggregated statistics table
filtered_rows = new_thicket.statsframe.dataframe.apply(filter_function, axis=1)
Expand Down