Pierre GM-2 wrote:
>
> Confirmed, it's a bug all right. Would you mind opening a ticket ?
> I'll try to take care of that in the next few days.
>
Done - http://projects.scipy.org/numpy/ticket/1283
Thanks!
Thomas
--
View this message in context:
http://old.nabble.com/Automatic-string-len
On Nov 4, 2009, at 11:35 AM, Thomas Robitaille wrote:
>
>
> Pierre GM-2 wrote:
>>
>> As a workwaround, perhaps you could use np.object instead of np.str
>> while defining your array. You can then get the maximum string length
>> by looping, as David suggested, and then use .astype to transform
On Tue, Nov 3, 2009 at 11:43 AM, David Warde-Farley wrote:
> On 2-Nov-09, at 11:35 PM, Thomas Robitaille wrote:
>
> > But if I want to specify the data types:
> >
> > np.rec.fromrecords([(1,'hello'),(2,'world')],dtype=[('a',np.int8),
> > ('b',np.str)])
> >
> > the string field is set to a length o
Pierre GM-2 wrote:
>
> As a workwaround, perhaps you could use np.object instead of np.str
> while defining your array. You can then get the maximum string length
> by looping, as David suggested, and then use .astype to transform your
> array...
>
I tried this:
np.rec.fromrecords([(1,'
On Nov 3, 2009, at 11:43 AM, David Warde-Farley wrote:
> On 2-Nov-09, at 11:35 PM, Thomas Robitaille wrote:
>
>> But if I want to specify the data types:
>>
>> np.rec.fromrecords([(1,'hello'),(2,'world')],dtype=[('a',np.int8),
>> ('b',np.str)])
>>
>> the string field is set to a length of zero:
>
On 2-Nov-09, at 11:35 PM, Thomas Robitaille wrote:
> But if I want to specify the data types:
>
> np.rec.fromrecords([(1,'hello'),(2,'world')],dtype=[('a',np.int8),
> ('b',np.str)])
>
> the string field is set to a length of zero:
>
> rec.array([(1, ''), (2, '')], dtype=[('a', '|i1'), ('b', '|S0')
Hi,
I'm having trouble with creating np.string_ fields in recarrays. If I
create a recarray using
np.rec.fromrecords([(1,'hello'),(2,'world')],names=['a','b'])
the result looks fine:
rec.array([(1, 'hello'), (2, 'world')], dtype=[('a', 'http://mail.scipy.org/mailman/listinfo/numpy-discussion