[Numpy-discussion] Structured array with no fields - possible?

Matthew Brett matthew.brett@gmail....
Sat May 2 23:54:44 CDT 2009


I'm trying to fix a bug in the scipy matlab loading routines, and this
requires me to somehow represent an empty structured array.

In matlab this is:

>> a = struct()

In numpy, you can do this:

In [1]: dt = np.dtype([])

but then you can't use it:

In [2]: np.zeros((),dtype=dt)
ValueError                                Traceback (most recent call last)

/home/mb312/tmp/<ipython console> in <module>()

ValueError: Empty data-type

Is there any way of representing a structured / record array, but with
no fields?

Thanks for any thoughts,


More information about the Numpy-discussion mailing list