From 50543bd22a710da01d8e1b9e20a430822dabbabc Mon Sep 17 00:00:00 2001 From: Peter Vacho Date: Mon, 25 Nov 2024 11:37:12 +0100 Subject: [PATCH] Handle empty dataframes --- src/util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util.py b/src/util.py index cc454b6..4fe77b7 100644 --- a/src/util.py +++ b/src/util.py @@ -19,7 +19,7 @@ def dataframe_to_urlmap(df: pd.DataFrame) -> dict[httpx.URL, set[httpx.URL]]: :return: A dictionary where the key is a source URL, and the value is a set of target URLs. """ urlmap = {} - for source, target in zip(df["source"], df["target"], strict=True): + for source, target in zip(df.get("source", pd.Series()), df.get("target", pd.Series()), strict=True): source_url = httpx.URL(source) target_url = httpx.URL(target) if source_url not in urlmap: