Skip to content

Commit 248807e

Browse files
authored
[kayjan#216] fix error in nan check
1 parent 1269263 commit 248807e

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

bigtree/tree/export.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from __future__ import annotations
1+
:from __future__ import annotations
22

33
import collections
44
import math
@@ -50,6 +50,12 @@
5050

5151
T = TypeVar("T", bound=Node)
5252

53+
def _safe_isnan(input_value):
54+
try:
55+
numeric_value = float(input_value)
56+
return math.isnan(numeric_value)
57+
except ValueError:
58+
return False
5359

5460
def _isnull(value: Any) -> bool:
5561
"""Check if value is null
@@ -60,7 +66,7 @@ def _isnull(value: Any) -> bool:
6066
Returns:
6167
(bool)
6268
"""
63-
if not value or math.isnan(value):
69+
if not value or _safe_isnan(value):
6470
return True
6571
return False
6672

0 commit comments

Comments
 (0)