Skip to content

Commit b554e97

Browse files
committed
set None unit to a default value N/A
1 parent 422481c commit b554e97

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/cehrbert/data_generators/hf_data_generator/hf_dataset_mapping.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -578,6 +578,11 @@ def transform(self, record: Dict[str, Any]) -> Dict[str, Any]:
578578
input_ids = self._concept_tokenizer.encode(record["concept_ids"])
579579
record["input_ids"] = input_ids
580580
concept_value_masks = record["concept_value_masks"]
581+
units = record["units"]
582+
if np.isnan(units).any():
583+
units = record["units"].copy()
584+
units[np.isnan(units)] = "N/A"
585+
581586
# Backward compatibility
582587
if "concept_values" not in record:
583588
record["concept_values"] = record["number_as_values"]

0 commit comments

Comments
 (0)