Merged in bugfix/fill_claim_type (pull request #874)
Bugfix/fill claim type * Handle if AARETE_DERIVED_CLAIM_TYPE_CD comes in as list * add unit tests * Black format Approved-by: Siddhant Medar
This commit is contained in:
@@ -880,8 +880,15 @@ def fill_claim_type_from_title(df: pd.DataFrame) -> pd.DataFrame:
|
||||
file_mask = df["FILE_NAME"] == file_name
|
||||
file_rows = df.loc[file_mask, "AARETE_DERIVED_CLAIM_TYPE_CD"]
|
||||
|
||||
# Get non-empty values for this file
|
||||
non_empty_values = [v for v in file_rows if not string_utils.is_empty(v)]
|
||||
# Get non-empty values for this file, normalizing lists to strings
|
||||
non_empty_values = []
|
||||
for v in file_rows:
|
||||
if not string_utils.is_empty(v):
|
||||
# Convert lists to their first element if present
|
||||
if isinstance(v, list) and len(v) > 0:
|
||||
non_empty_values.append(v[0])
|
||||
elif not isinstance(v, list):
|
||||
non_empty_values.append(v)
|
||||
|
||||
if non_empty_values:
|
||||
# Use mode (most common value) to fill empty rows in this file
|
||||
|
||||
Reference in New Issue
Block a user