File size: 644 Bytes
2cfc97b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import pandas as pd

def column_recall_score(expected: pd.DataFrame, generated: pd.DataFrame) -> float:
    if expected.shape[0] != generated.shape[0]:
        return 0.0

    matched = 0
    used_columns = set()

    for exp_col in expected.columns:
        found = False

        for gen_col in generated.columns:
            if gen_col in used_columns:
                continue

            if expected[exp_col].equals(generated[gen_col]):
                matched += 1
                used_columns.add(gen_col)
                found = True
                break

    total = expected.shape[1]
    return matched / total if total > 0 else 0.0