This repository contains a Python script for comparing precision R values from two separate teams and generating a final table that highlights differences and averages.
- File Processing:
- Reads and processes input files containing precision R values in a markdown-style table format.
- Comparison:
- Calculates the difference between precision R values from two teams for each query.
- Summary Row:
- Adds a summary row with the average precision R values and their differences.
- Output:
- Saves the final table in a readable text format.
lab8.py
: Main Python script for reading, processing, and comparing precision R values.metrics_results.txt
: Input file containing precision R values from Team 1.metrics_results_gnok.txt
: Input file containing precision R values from Team 2.tabla_final.txt
: Output file containing the comparison table with differences and averages.
-
Read Input Files: The script reads the precision R values from
metrics_results.txt
andmetrics_results_gnok.txt
. The columns are parsed, cleaned, and converted into numeric format. -
Calculate Differences: For each query, the difference between Team 1's and Team 2's precision R values is computed.
-
Add Summary Row: The average precision R values for both teams and the mean difference are calculated and appended as a special row labeled
P(PR)
. -
Save Final Table: The resulting table is saved as
tabla_final.txt
with a structured format:Consulta PRA(i) PRB(i) PRA(i)-PRB(i) 1 0.850 0.800 0.050 2 0.780 0.750 0.030 ... ... ... ... P(PR) 0.815 0.775 0.040
-
Clone the repository:
git clone https://github.com/KPlanisphere/precision-r-comparison.git cd precision-r-comparison
-
Place the input files (
metrics_results.txt
,metrics_results_gnok.txt
) in the directory or update their paths inlab8.py
. -
Run the script:
python lab8.py
-
Check the output in
tabla_final.txt
.
- Python 3.10+
- pandas
To install the required library, run:
pip install pandas
- Ensure the input files follow the expected markdown-style table format with a
|
delimiter. - The script includes error handling for missing or non-numeric data.