[Numpy-discussion] dtype=object behavior change from 0.9.6 to beta 1
Charles R Harris
charlesr.harris at gmail.com
Thu Aug 31 10:44:14 CDT 2006
On 8/31/06, Tom Denniston <tom.denniston at alum.dartmouth.org> wrote:
>
> In version 0.9.6 one used to be able to do this:
>
> In [4]: numpy.__version__
> Out[4]: '0.9.6'
>
>
> In [6]: numpy.array([numpy.array([4,5,6]), numpy.array([1,2,3])],
> dtype=object).shape
> Out[6]: (2, 3)
>
>
> In beta 1 numpy.PyObject no longer exists. I was trying to get the
> same behavior with dtype=object but it doesn't work:
>
> In [7]: numpy.__version__
> Out[7]: '1.0b1'
>
> In [8]: numpy.array([numpy.array([4,5,6]), numpy.array([1,2,3])],
> dtype=object).shape
> Out[8]: (2,)
The latter looks more correct, in that is produces an array of objects. To
get the previous behaviour there is the function vstack:
In [6]: a = array([1,2,3])
In [7]: b = array([4,5,6])
In [8]: vstack([a,b])
Out[8]:
array([[1, 2, 3],
[4, 5, 6]])
Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20060831/a75bf01a/attachment.html
More information about the Numpy-discussion
mailing list