Re: [Numpy-discussion] creation of ndarray with dtype=np.object : bug?

2014-12-03 Thread Emanuele Olivetti
On 12/03/2014 04:32 AM, Ryan Nelson wrote: Emanuele, This doesn't address your question directly. However, I wonder if you could approach this problem from a different way to get what you want. First of all, create a index array and then just vstack all of your arrays at once. Ryan,

Re: [Numpy-discussion] creation of ndarray with dtype=np.object : bug?

2014-12-03 Thread Jaime Fernández del Río
On Wed, Dec 3, 2014 at 2:21 AM, Emanuele Olivetti emanu...@relativita.com wrote: On 12/03/2014 04:32 AM, Ryan Nelson wrote: Emanuele, This doesn't address your question directly. However, I wonder if you could approach this problem from a different way to get what you want. First of

Re: [Numpy-discussion] creation of ndarray with dtype=np.object : bug?

2014-12-03 Thread Emanuele Olivetti
On 12/03/2014 12:17 PM, Jaime Fernández del Río wrote: The safe way to create 1D object arrays from a list is by preallocating them, something like this: a = [np.random.rand(2, 3), np.random.rand(2, 3)] b = np.empty(len(a), dtype=object) b[:] = a b array([ array([[ 0.124382 ,

[Numpy-discussion] creation of ndarray with dtype=np.object : bug?

2014-12-02 Thread Emanuele Olivetti
Hi, I am using 2D arrays where only one dimension remains constant, e.g.: --- import numpy as np a = np.array([[1, 2, 3], [4, 5, 6]]) # 2 x 3 b = np.array([[9, 8, 7]]) # 1 x 3 c = np.array([[1, 3, 5], [7, 9, 8], [6, 4, 2]]) # 3 x 3 d = np.array([[5, 5, 4], [4, 3, 3]]) # 2 x 3 --- I have a large

Re: [Numpy-discussion] creation of ndarray with dtype=np.object : bug?

2014-12-02 Thread Ryan Nelson
Emanuele Olivetti emanuele at relativita.com writes: Hi, I am using 2D arrays where only one dimension remains constant, e.g.: --- import numpy as np a = np.array([[1, 2, 3], [4, 5, 6]]) # 2 x 3 b = np.array([[9, 8, 7]]) # 1 x 3 c = np.array([[1, 3, 5], [7, 9, 8], [6, 4, 2]]) # 3 x 3