A Thursday 16 December 2010 11:07:26 Andrey Sobolev escrigué:
> Hi,
> 
> it seems that modifyRows() method does not work. When I try to modify
> a row I get an error:
> 
> Object cannot be converted into a recarray object compliant with
> table format '[('ADCcount', '()u2'), ('TDCcount', '()u1'),
> ('energy', '()f8'), ('grid_i', '()i4'), ('grid_j', '()i4'),
> ('idnumber', '()i8'), ('name', '()S16'), ('pressure', '()f4')]'. The
> error was: <mismatch between the number of fields and the number of
> arrays>
> 
> (table from the example from the pytables "getting started" page)
> 
> I do the modification using:
> 
> row = table[1]
> row['ADCcount'] = 250
> table.modifyRows(1, rows=[row])
> 
> So the dimensions are 100% the same!
> The error is always present, with no dependency on number of columns
> in table, column formats, etc. What can be is wrong?
> The modifyCoordinates() gives the same error. So there's no way to
> modify data in a table..

Yeah, that's a deficiency in the way a NumPy void is treated, and that 
should be addressed. Added a ticket:

http://pytables.org/trac/ticket/328

Meanwhile, you can do what you want by adding an extra set of "[]" 
brackets:

table.modifyRows(1, rows=[[row]])

or, you can find the next idiom more readable:

table[1] = [r]

Thanks for reporting!

-- 
Francesc Alted

------------------------------------------------------------------------------
Lotusphere 2011
Register now for Lotusphere 2011 and learn how
to connect the dots, take your collaborative environment
to the next level, and enter the era of Social Business.
http://p.sf.net/sfu/lotusphere-d2d
_______________________________________________
Pytables-users mailing list
Pytables-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pytables-users

Reply via email to