Skip to content

Commit 65b7e79

Browse files
authored
Improve source URL retrieval in adapt_explorer.py
Add handling for multiple source URL column names in DataFrame.
1 parent 359bef6 commit 65b7e79

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

scripts/adapt_explorer.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ def _ser(df: pd.DataFrame, col: str) -> "pd.Series":
4242

4343

4444
def _src_url(df: pd.DataFrame) -> "pd.Series":
45+
# Explorer non è uniforme: alcuni dataset usano "source_url",
46+
# altri (incarichi) usano "fonte_url". Proviamo prima il nome corretto
47+
# per ciascun dataset e poi il fallback, senza mai fallire silenziosamente su entrambi.
48+
if "source_url" in df.columns:
49+
return _ser(df, "source_url")
4550
return _ser(df, "fonte_url")
4651

4752

0 commit comments

Comments
 (0)