mirror of
https://github.com/mwisnowski/mtg_python_deckbuilder.git
synced 2025-12-16 15:40:12 +01:00
fix: handle numpy arrays in parse_theme_tags
Parquet files return numpy arrays, not Python lists. Added conversion from ndarray to list before processing theme tags.
This commit is contained in:
parent
7a94e195b7
commit
db0b0ccfdb
1 changed files with 6 additions and 0 deletions
|
|
@ -73,6 +73,12 @@ def canonical_key(raw: str) -> str:
|
||||||
def parse_theme_tags(value: object) -> List[str]:
|
def parse_theme_tags(value: object) -> List[str]:
|
||||||
if value is None:
|
if value is None:
|
||||||
return []
|
return []
|
||||||
|
# Handle numpy arrays (from Parquet files)
|
||||||
|
if hasattr(value, '__array__') or hasattr(value, 'tolist'):
|
||||||
|
try:
|
||||||
|
value = value.tolist() if hasattr(value, 'tolist') else list(value)
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
if isinstance(value, list):
|
if isinstance(value, list):
|
||||||
return [str(v) for v in value if isinstance(v, str) and v.strip()]
|
return [str(v) for v in value if isinstance(v, str) and v.strip()]
|
||||||
if isinstance(value, str):
|
if isinstance(value, str):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue