Skip to content

compare.py: Drop "hash" column for average merging #256

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 12, 2025
Merged
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
13 changes: 10 additions & 3 deletions utils/compare.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,13 @@ def readmulti(filenames):
return d


def merge_values(values, merge_function):
# Drop the "hash" column because it's irreducible for averages.
if merge_function is pd.DataFrame.mean and "hash" in values.columns:
values = values[[c for c in values.columns if c != "hash"]]
return values.groupby(level=1).apply(merge_function)


def get_values(values):
# Create data view without diff column.
if "diff" in values.columns:
Expand Down Expand Up @@ -417,11 +424,11 @@ def main():
lhs = files[0:split]
rhs = files[split + 1 :]

# Filter minimum of lhs and rhs
# Combine the multiple left and right hand sides.
lhs_d = readmulti(lhs)
lhs_merged = lhs_d.groupby(level=1).apply(config.merge_function)
lhs_merged = merge_values(lhs_d, config.merge_function)
rhs_d = readmulti(rhs)
rhs_merged = rhs_d.groupby(level=1).apply(config.merge_function)
rhs_merged = merge_values(rhs_d, config.merge_function)

# Combine to new dataframe
data = pd.concat(
Expand Down