Skip to content

Commit ef0d697

Browse files
committed
Returning @ for incomplete data strings
1 parent fd9f648 commit ef0d697

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

api/table_annotator/pre_annotated.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,11 @@ def find_column(table: Table, column_type: str) -> Optional[int]:
4040
return None
4141

4242
def transform_birthdate(date_normalized: str) -> str:
43-
dt = datetime.datetime.strptime(date_normalized, '%Y%m%d')
44-
return f"{dt.day}.{dt.month}.{dt.year%100:02d}"
43+
try:
44+
dt = datetime.datetime.strptime(date_normalized, '%Y%m%d')
45+
return f"{dt.day}.{dt.month}.{dt.year%100:02d}"
46+
except ValueError:
47+
return "@"
4548

4649

4750
def apply_pre_annotated_csv(image_path: str, table: Table, offset: int = 0) -> CellGrid[Cell]:

0 commit comments

Comments
 (0)