Re: [Tutor] list to numpy record array

2010-02-23 Thread Kent Johnson
On Mon, Feb 22, 2010 at 11:50 PM, Vincent Davis
vinc...@vincentdavis.net wrote:

 I must be missing something simple. I have a list of lists data = [['  0', ' 
  0', '234.0', '24.0', ' 25'], ['  1', '  0', '22428.0', '2378.1', ' 
 25'],.. and what to make a record array from it but it gets screwed up 
 or I don't get it, maybe both.

 bdata = numpy.array(data, [('x', int),('y', 
 int),('mean',float),('stdv',float),('npixcels',int)])
  bdata
 array([[(3153952, 0, 0.0, 0.0, 0), (3153952, 0, 0.0, 0.0, 0),
...
         (3486240, 0, 0.0, 0.0, 0)]],

       dtype=[('x', 'i8'), ('y', 'i8'), ('mean', 'f8'), ('stdv', 'f8'), 
 ('npixcels', 'i8')])

All I know about RecordArrays is from reading this page:
http://www.scipy.org/RecordArrays
but it looks like you have done the right thing and created a
RecordArray. What is wrong with this result?

Kent
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] list to numpy record array

2010-02-23 Thread Vincent Davis
@Kent
All I know about RecordArrays is from reading this page:
http://www.scipy.org/RecordArrays
but it looks like you have done the right thing and created a
RecordArray. What is wrong with this result?

The number are completely different, or I have no idea how to read it.
Here are the first row of each
normal array  ['  0', '  0', '234.0', '24.0', ' 25']
Record array  [(3153952, 0, 0.0, 0.0, 0)

*Vincent Davis
720-301-3003 *
vinc...@vincentdavis.net
 my blog http://vincentdavis.net |
LinkedInhttp://www.linkedin.com/in/vincentdavis


On Tue, Feb 23, 2010 at 6:30 AM, Kent Johnson ken...@tds.net wrote:

 On Mon, Feb 22, 2010 at 11:50 PM, Vincent Davis
 vinc...@vincentdavis.net wrote:
 
  I must be missing something simple. I have a list of lists data = [['
  0', '  0', '234.0', '24.0', ' 25'], ['  1', '  0', '22428.0', '2378.1', '
 25'],.. and what to make a record array from it but it gets screwed up
 or I don't get it, maybe both.
 
  bdata = numpy.array(data, [('x', int),('y',
 int),('mean',float),('stdv',float),('npixcels',int)])
   bdata
  array([[(3153952, 0, 0.0, 0.0, 0), (3153952, 0, 0.0, 0.0, 0),
 ...
  (3486240, 0, 0.0, 0.0, 0)]],
 
dtype=[('x', 'i8'), ('y', 'i8'), ('mean', 'f8'), ('stdv',
 'f8'), ('npixcels', 'i8')])

 All I know about RecordArrays is from reading this page:
 http://www.scipy.org/RecordArrays
 but it looks like you have done the right thing and created a
 RecordArray. What is wrong with this result?

 Kent

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor