Quansight-Labs / numpy.net

A port of NumPy to .Net
BSD 3-Clause "New" or "Revised" License
128 stars 14 forks source link

Confusing instruction: System.Exception: Unable to determine array type. Could not find any non-null entries. Please specify dtype #32

Closed Happypig375 closed 1 year ago

Happypig375 commented 2 years ago
System.Console.WriteLine(np.array(new string[,]{
  { null, null }, { null, null }
}))

throws

Error: System.Exception: Unable to determine array type. Could not find any non-null entries. Please specify dtype
at NumpyDotNet.np.FindFirstNonNullValue(Array ssrc)
at NumpyDotNet.np.asanyarray(Object a, dtype dtype, NPY_ORDER order)
at NumpyDotNet.np.FromAny(Object src, dtype descr, Int32 minDepth, Int32 maxDepth, NPYARRAYFLAGS flags, Object context)
at NumpyDotNet.np.CheckFromAny(Object src, dtype descr, Int32 minDepth, Int32 maxDepth, NPYARRAYFLAGS requires, Object context)
at NumpyDotNet.np.array(Object src, dtype dtype, Boolean copy, NPY_ORDER order, Boolean subok, Int32 ndmin)

However, specifying dtype does not change this fact. The same exception is still thrown.

System.Console.WriteLine(np.array(new string[,]{
  { null, null }, { null, null }
}, np.Strings))
KevinBaselinesw commented 2 years ago

I accepted your changes. They will be in the next release.