[Numpy-discussion] dtype=object behavior change from 0.9.6 to beta 1
Charles R Harris
charlesr.harris at gmail.com
Thu Aug 31 12:36:16 CDT 2006
On 8/31/06, Tom Denniston <tom.denniston at alum.dartmouth.org> wrote:
>
> But i have hetergenious arrays that have numbers and strings and NoneType,
> etc.
>
> Take for instance:
>
> In [11]: numpy.array([numpy.array([1,'A', None]),
> numpy.array([2,2,'Some string'])], dtype=object)
> Out[11]:
> array([[1, A, None],
> [2, 2, Some string]], dtype=object)
>
> In [12]: numpy.array([numpy.array([1,'A', None]),
> numpy.array([2,2,'Some string'])], dtype=object).shape
> Out[12]: (2, 3)
>
> Works fine in Numeric and pre beta numpy but in beta numpy versions i get:
I think you want:
In [59]: a = array([array([1,'A', None],dtype=object),array([2,2,'Some
string'],dtype=object)])
In [60]: a.shape
Out[60]: (2, 3)
Which makes good sense to me.
Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20060831/8c8e0907/attachment.html
More information about the Numpy-discussion
mailing list