[Numpy-discussion] Structured array with no fields - possible?
S. Chris Colbert
Tue May 5 00:38:37 CDT 2009
you can create an array without changing the values of the allocated memory
by using numpy.empty() or numpy.ndarray()
this will allow you to create an array of any size without specifying the
I'm not sure what you mean by "empty", because any memory address will have
a value, whether its assigned to or not.
From: "Matthew Brett" <firstname.lastname@example.org>
Sent: Tuesday, May 05, 2009 12:56 AM
To: "Discussion of Numerical Python" <email@example.com>
Subject: Re: [Numpy-discussion] Structured array with no fields - possible?
>>> I'm trying to fix a bug in the scipy matlab loading routines, and this
>>> requires me to somehow represent an empty structured array.
>> Do you need the struct to be empty (size is 0) or to have no fields ?
>> What would you expect np.zeros((), dtype=np.dtype()) to return, for
>> example ?
> Yes, I've got nothing - I have no idea what that might return.
> I'm afraid what I need is some way of representing the fact that I
> have read, from matlab, a structure with no fields (and therefore no
> data) that can be - say - shape (10,2) - or any other.
> Some time ago we thought of switching to structured arrays to
> represent matlab structs, but this begins to make me think again.
> Thanks for the replies,
> Numpy-discussion mailing list
More information about the Numpy-discussion