Kevin Christman (el 2008-02-15 a les 08:00:02 -0800) va dir::

> sorry about the mangled table and un-indented code.  Here is the
> formatting preserved:
> http://docs.google.com/View?docid=dcmrvf8_31cfvc7vfs
> 
> So I recognize that row.append() should be applied only *once*, and
> that my current code is bad. However, my question then is *how* does
> one fill the subrows with data?  For example, after filling in the
> sub-sub-row with 25% and 80% how do I proceed to fill in the next
> sub-sub-row with 50% and 85%?

Umm, I think you have a wrong conception of what nested types are.  If
you have the following table description::

  class MyTable(IsDescription):
      x = IntCol(pos=0)
      class y(IsDescription):
          _v_pos = 1
          a = IntCol(pos=0)
          b = IntCol(pos=1)

That *doesn't* mean that you can build a table like this:

  +----+-----+-----+
  | x1 | y1a | y1b |
  |    +-----+-----+
  |    | y2a | y2b |
  |    +-----+-----+
  |    |    ...    |
  |    +-----+-----+
  |    | yNa | yNb |
  +----+-----------+
  | x2 | y1a | y1b |
  |    +-----+-----+
  |    |    ...    |
  |    +-----+-----+
  |    | yMa | yMb |
  +----+-----------+

I.e. for each "x" row you *can't* append a (variable or fixed) number of
"y subrows": it isn't a 1-to-N relationship between row and "subrows".
On the contrary, fields in a nested field are nothing more than normal
fields which bear a strong relationship between them (like x, y, z in a
3D coordinate), but there is *only one value of them per row*, just as
the other fields in it, so the table looks like:

  +----+-----+-----+
  | x1 | y1a : y1b |
  +----+-----+-----+
  | x2 | y2a : y2b |
  +----+-----+-----+
  |      ...       |
  +----+-----+-----+
  | xN | yNa : yNb |
  +----+-----+-----+

If that is difficult for you, picture yourself a "flattened" version of
the table like this:

  +----+------+------+
  | x1 | y1/a | y1/b |
  +----+------+------+
  | x2 | y2/a | y2/b |
  +----+------+------+
  |       ...        |
  +----+------+------+
  | xN | yN/a | yN/b |
  +----+------+------+

Please note that there are as many "xN" as "yN/a" as "yN/b", and "xi",
"yi/a" and "yi/b" for a given "i" are all in the same row.

I'm interested in knowing if you got that erroneous interpretation by
reading the PyTables documentation.  In that case, please tell us which
piece of doc it was so that we can rewrite it in a clearer fashion.

Hope that helps,

::

        Ivan Vilata i Balaguer   >qo<   http://www.carabos.com/
               Cárabos Coop. V.  V  V   Enjoy Data
                                  ""

Attachment: signature.asc
Description: Digital signature

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Pytables-users mailing list
Pytables-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pytables-users

Reply via email to