We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 54ef202 + 6062dc7 commit 94a6923Copy full SHA for 94a6923
src/dask_awkward/lib/core.py
@@ -706,6 +706,8 @@ def new_known_scalar(
706
dtype = np.dtype(int)
707
elif isinstance(s, (float, np.floating)):
708
dtype = np.dtype(float)
709
+ elif hasattr(s, "dtype"):
710
+ dtype = getattr(s, "dtype")
711
else:
712
dtype = np.dtype(type(s))
713
tests/test_core.py
@@ -466,6 +466,14 @@ def test_new_known_scalar() -> None:
466
assert c.compute() == s1
467
468
469
+def test_new_known_scalar_from_array() -> None:
470
+ s = np.array(0.0)
471
+ c = new_known_scalar(s)
472
+ assert c.compute() == s
473
+ assert c._meta is not None
474
+ assert c.dtype == s.dtype
475
+
476
477
def test_scalar_dtype() -> None:
478
s = 2
479
c = new_known_scalar(s)
0 commit comments