Skip to content

Commit

Permalink
Bug fix: numpy float interpreted as VECTOR
Browse files Browse the repository at this point in the history
  • Loading branch information
dsblank committed Dec 6, 2022
1 parent 3c92182 commit 6c7ff95
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions backend/kangas/datatypes/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,17 +152,17 @@ def pytype_to_dgtype(item):
else:
return "JSON"

if hasattr(item, "tolist"):
## numpy arrays
return "VECTOR"

if hasattr(item, "item") and callable(item.item):
## numpy types
try:
item = item.item()
except Exception:
pass

if hasattr(item, "tolist") and not isinstance(item, numbers.Number):
## numpy arrays
return "VECTOR"

for ctype in DATAGRID_TYPES:
if isinstance(item, tuple(DATAGRID_TYPES[ctype]["types"])):
return ctype
Expand Down

0 comments on commit 6c7ff95

Please sign in to comment.