Skip to content
Permalink
5ab4ed8e4a
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
25 lines (18 sloc) 754 Bytes
import pandas as pd
import sys
if len(sys.argv) < 2:
print(sys.argv)
print("e.g. python3 calc_consensus.py ./CSP_7jq8.csv")
raise
input_file = sys.argv[1]
# Read the CSV file
df = pd.read_csv(input_file)
# Check if 'metric_comp_consensus' column exists, if not, add it
if 'metric_comp_consensus' not in df.columns:
df['metric_comp_consensus'] = 0.0 # Initialize with 0.0 or any default value
# Calculate 'metric_comp_consensus' for each row
df['metric_comp_consensus'] = (df['metric_comp_F1-harmonic_ind2.5_dir3'] +
((df['metric_comp_MCC_ind2.5_dir3'] / 2) + 0.5)) / 2
# Save the modified DataFrame to a new CSV file
df.to_csv(input_file, index=False)
print(f"Modified data saved to {input_file}.")