Skip to content

Commit 5ff65bf

Browse files
fix data representation for flight summary
1 parent 2393f44 commit 5ff65bf

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/utils.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def to_python_primitive(v: Any) -> Any:
1616
1717
Args:
1818
v: Any value, particularly those with a 'source' attribute
19-
containing numpy arrays or generic types.
19+
containing numpy arrays or generic types.
2020
2121
Returns:
2222
The primitive representation of the input value.
@@ -29,6 +29,13 @@ def to_python_primitive(v: Any) -> Any:
2929
return v.source.item()
3030

3131
return str(v.source)
32+
33+
if isinstance(v, (np.generic,)):
34+
return v.item()
35+
36+
if isinstance(v, (np.ndarray,)):
37+
return v.tolist()
38+
3239
return str(v)
3340

3441

0 commit comments

Comments
 (0)