| 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 |