Skip to content

Commit 2a326e3

Browse files
committed
fix: avoid outputting nan for id cache
1 parent a97cf7b commit 2a326e3

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

ferry/transform/cache_id.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def save_id_cache(tables: dict[str, pd.DataFrame], data_dir: Path):
7171
.set_index(["building_code", "room"])["location_id"]
7272
.to_dict()
7373
)
74-
location_to_id = {f"{k[0]} {k[1] or ''}": v for k, v in location_to_id.items()}
74+
location_to_id = {f"{k[0]} {'' if pd.isna(k[1]) else k[1]}": v for k, v in location_to_id.items()}
7575
professor_to_id = (
7676
tables["professors"].set_index(["name", "email"])["professor_id"].to_dict()
7777
)

ferry/transform/import_courses.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ def report_multiple_names(row: pd.DataFrame):
287287

288288
locations["location_id"] = generate_id(
289289
locations,
290-
lambda row: f"{row['code']} {row['room'] or ''}",
290+
lambda row: f"{row['code']} {'' if pd.isna(row['room']) else row['room']}",
291291
data_dir / "id_cache" / "location_id.json",
292292
)
293293
location_to_id = locations.set_index(["code", "room"])["location_id"].to_dict()

0 commit comments

Comments
 (0)