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

Matthew Brett matthew.brett at gmail.com
Sun May 3 00:54:44 EDT 2009


Hello,

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,

Matthew



More information about the NumPy-Discussion mailing list