Skip to content

Commit

Permalink
Add select_from_results.py script
Browse files Browse the repository at this point in the history
  • Loading branch information
mernst committed Apr 28, 2024
1 parent 40f2fac commit f52ebb6
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions src/python/select_from_results.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

"""Output a subset of the results that match a hard-coded condition, to a hard-coded file.
To change the condition or file, edit this script.
"""

import pandas as pd

df = pd.read_csv("../../results/combined/result.csv", index_col="idx")

# print(df.iloc[3])
# print(df.iloc[3].gitmerge_ort_imports_ignorespace)
# print(df.iloc[3].gitmerge_ort_ignorespace)
# print(
# df.iloc[3].gitmerge_ort_imports_ignorespace == df.iloc[3].gitmerge_ort_ignorespace
# )


def is_success(val):
"""Returns true if the given result is a success result."""
return val == "Tests_passed"


def merge_failed(val):
"""Returns true if the given result indicates that the merge succeeded."""
return val == "Merge_failed"


def merge_succeeded(val):
"""Returns true if the given result indicates that the merge succeeded."""
return val != "Merge_failed"


# Retain rows where gitmerge_ort_imports_ignorespace and gitmerge_ort_ignorespace differ.
# df = df[
# merge_failed(df.gitmerge_ort_imports_ignorespace)
# != merge_failed(df.gitmerge_ort_ignorespace)
# ]
# df.to_csv("../../results/combined/imports-differs-from-ort.csv", index_label="idx")

# Select some rows.
df = df[merge_failed(df.gitmerge_ort) != merge_failed(df.spork)]
# Select some columns (is it OK to omit "idx"??)
df = df[["gitmerge_ort", "spork"]]

df.to_csv("../../results/combined/spork-differs-from-ort.csv", index_label="idx")

0 comments on commit f52ebb6

Please sign in to comment.