[Numpy-discussion] Error using rec.fromrecords with specific dtype

2008-08-07 Thread Sameer DCosta
Hi, I am unable to specify a dtype when using numpy.rec.fromrecords. This problem only occurs when one of the dtypes is an object. (Please see below) Thanks in advance for your help. Sameer In [7]: import datetime, numpy as np In [8]: print np.__version__ 1.2.0.dev5253 In [9]: dtype=np.dtype(

Re: [Numpy-discussion] Error creating an array

2008-08-05 Thread Sameer DCosta
On Tue, Aug 5, 2008 at 2:35 PM, Travis E. Oliphant <[EMAIL PROTECTED]> wrote: > You must uses tuples for the individual "records" when constructing > arrays with the "array" command. Thanks Travis. Is there a reason why numpy insists on tuples? Anyway, moving on, this brings me to the real proble

[Numpy-discussion] Error creating an array

2008-08-05 Thread Sameer DCosta
Im having a little trouble creating a numpy array with a specific dtype. I can create the array b with dtype=int, but not with the dtype I want. Any idea what I am doing wrong here? In [450]: import numpy as np In [451]: print np.__version__ 1.2.0.dev5243 In [452]: dtype=np.dtype([('spam', ' 1

[Numpy-discussion] Renaming record array fields (bug)

2008-06-04 Thread Sameer DCosta
Hi, There is a bug renaming record array fields if some field names are the same. I reopened this ticket http://scipy.org/scipy/numpy/ticket/674 and attached a tiny patch. Maybe I should have opened a new ticket. Anyway, here is an example that causes a segfault on the latest svn version. import

Re: [Numpy-discussion] Rename record array fields (with object arrays)

2008-03-06 Thread Sameer DCosta
On Sat, Mar 1, 2008 at 10:43 PM, Travis E. Oliphant <[EMAIL PROTECTED]> wrote: > > Can you try: > > olddt.names = ['notfoo', 'notbar'] > > on a recent SVN tree. This should now work > Thanks Travis, this works great!! Sameer ___ Numpy-discussion

Re: [Numpy-discussion] Rename record array fields (with object arrays)

2008-02-28 Thread Sameer DCosta
On Thu, Feb 28, 2008 at 2:11 PM, Robert Kern <[EMAIL PROTECTED]> wrote: > On Thu, Feb 28, 2008 at 2:00 PM, Sameer DCosta <[EMAIL PROTECTED]> wrote: > > was going to create a ticket for this, but I don't think I have > > permissions to do this. Can someone

Re: [Numpy-discussion] Rename record array fields (with object arrays)

2008-02-28 Thread Sameer DCosta
ROTECTED]> wrote: > > Sameer DCosta wrote: > > Hi, > > > > I'm having trouble renaming record array fields if they contain object > > arrays in them. I followed the solutions posted by Robert Kern and > > Stefan van der Walt (Thanks again) but it d

[Numpy-discussion] Rename record array fields (with object arrays)

2008-02-28 Thread Sameer DCosta
Hi, I'm having trouble renaming record array fields if they contain object arrays in them. I followed the solutions posted by Robert Kern and Stefan van der Walt (Thanks again) but it doesn't look like this method works in all cases. For reference: http://projects.scipy.org/pipermail/numpy-discus

[Numpy-discussion] Rename record array fields

2008-02-20 Thread Sameer DCosta
Is there a way to rename record array fields without making a copy of the whole record array? Thanks in advance for your replies. Sameer ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discus

Re: [Numpy-discussion] numpy record array segfault

2008-02-20 Thread Sameer DCosta
On Wed, Feb 20, 2008 at 1:22 AM, Nils Wagner <[EMAIL PROTECTED]> wrote: > > On Tue, 19 Feb 2008 17:10:10 -0600 > "Sameer DCosta" <[EMAIL PROTECTED]> wrote: > > Hi, > > > > I'm getting a segfault when using python objects with > >rec

[Numpy-discussion] numpy record array segfault

2008-02-19 Thread Sameer DCosta
Hi, I'm getting a segfault when using python objects with record arrays. The code (below) basically assigns a single datetime object to a slice of a column in the record array and then python segfaults as soon as I try to access those array values. I'm using the latest svn version of numpy compile

[Numpy-discussion] Converting char array to float

2007-11-28 Thread Sameer DCosta
I'm trying to convert a character array to a floating point array. I'm using one of the recent svn builds. It is surprising that astype does not do the job. However if I first convert the char array to an array and then use astype everything works fine. Is this a bug? import numpy as N print N.__v

Re: [Numpy-discussion] Setting numpy record array elements

2007-08-20 Thread Sameer DCosta
On 8/20/07, Stefan van der Walt <[EMAIL PROTECTED]> wrote: > > This looks like a bug, since > > a[0][0] = 0 > > works fine. I'll take a closer look and make sure. > Thanks Stefan for offering to take a closer look. I have attached a patch against the latest svn which fixes this problem. Both thi

[Numpy-discussion] Setting numpy record array elements

2007-08-20 Thread Sameer DCosta
Hi, In the example below I have a record array *a* that has a column *col1". I am trying to set the first element of a.col1 to zero in two different ways. 1. a[0].col1 = 0 (This fails silently) 2. a.col1[0] = 0 (This works fine) I am using the latest svn version of numpy. Is this a bug? or is t

Re: [Numpy-discussion] Empty record arrays

2007-03-05 Thread Sameer DCosta
On 3/5/07, Christopher Barker <[EMAIL PROTECTED]> wrote: > empty() works too, but why would you want an empty array? I wanted to use rec.fromrecords so that the interface is consistent. For example, suppose I have a list comprehension that generates the variable "recs". Sometimes the list compreh

[Numpy-discussion] Empty record arrays

2007-03-05 Thread Sameer DCosta
Hi, I am trying to create record arrays using the numpy.rec.fromrecords. This function works just fine, however I am having a little trouble using it to create empty record arrays. If the array I start off with is empty and I have provided a dtype (or the names and the formats), then I expect rec.