Skip to content

Commit cd27d43

Browse files
authored
Merge pull request #68 from ImageMarkup/isic-167-skip-emptyish-values
2 parents 89829a2 + 6914213 commit cd27d43

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

isic_cli/cli/metadata.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,11 @@ def metadata(obj):
3535
def validate(csv_file: io.BufferedReader):
3636
"""Validate metadata from a local csv."""
3737
# These imports are slow, inline them.
38-
import numpy as np
3938
import pandas as pd
4039

4140
console = Console()
4241
df = pd.read_csv(csv_file, header=0)
4342

44-
# pydantic expects None for the absence of a value, not NaN
45-
df = df.applymap(lambda x: x.strip() if isinstance(x, str) else x)
46-
df = df.replace({np.nan: None, "": None})
47-
4843
# batch problems apply to the overall csv and can't be computed without looking at the
4944
# entire csv.
5045
batch_problems: list[dict] = []
@@ -54,8 +49,7 @@ def validate(csv_file: io.BufferedReader):
5449

5550
for i, (_, row) in track(enumerate(df.iterrows(), start=2), total=len(df)):
5651
try:
57-
row = row.to_dict()
58-
MetadataRow.model_validate({k: v for k, v in row.items() if v is not None})
52+
MetadataRow.model_validate(row.to_dict())
5953
except ValidationError as e:
6054
for error in e.errors():
6155
column = error["loc"][0]

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
# We expect girder-cli-oauth-client to drop oob support in the future
4444
"girder-cli-oauth-client<1.0.0",
4545
"humanize",
46-
"isic-metadata>=0.3.0",
46+
"isic-metadata>=0.4.0",
4747
"more-itertools",
4848
"numpy",
4949
"packaging",

0 commit comments

Comments
 (0)