Re: [Numpy-discussion] Coercing object arrays to string (or unicode) arrays

2009-09-24 Thread Michael Droettboom
I have filed a bug against this, along with a patch that fixes casting to fixed-size string arrays: http://projects.scipy.org/numpy/ticket/1235 Undefined-sized string arrays is a harder problem, which I'm deferring for later. Mike On 09/24/2009 01:19 PM, Michael Droettboom wrote: > On 09/24/2

Re: [Numpy-discussion] Coercing object arrays to string (or unicode) arrays

2009-09-24 Thread Michael Droettboom
On 09/24/2009 01:02 PM, Christopher Barker wrote: > Michael Droettboom wrote: > >> As I'm looking into fixing a number of bugs in chararray, I'm running >> into some surprising behavior. >> In [14]: x = np.array(['abcdefgh', 'ijklmnop'], 'O') >> >> # Without specifying the length, it seems to d

Re: [Numpy-discussion] Coercing object arrays to string (or unicode) arrays

2009-09-24 Thread Christopher Barker
Michael Droettboom wrote: > As I'm looking into fixing a number of bugs in chararray, I'm running > into some surprising behavior. > In [14]: x = np.array(['abcdefgh', 'ijklmnop'], 'O') > > # Without specifying the length, it seems to default to sizeof(int)... ??? > In [15]: np.array(x, 'S') > Ou

[Numpy-discussion] Coercing object arrays to string (or unicode) arrays

2009-09-23 Thread Michael Droettboom
As I'm looking into fixing a number of bugs in chararray, I'm running into some surprising behavior. One of the things chararray needs to do occasionally is build up an object array of string objects, and then convert that back to a fixed-length string array. This length is sometimes predeter