iter_nodes() File method vs _v_leaves Group attribute

19 views
Skip to first unread message

Ken Walker

unread,
Sep 24, 2018, 5:58:28 PM9/24/18
to pytables-users
I'm working with a HDF5 file format with Groups that may have a variety of 2d Table dataset names, and may have Groups. I've been using iter_nodes() to identify the Tables found in a particular model, then process based on what I find....
Recently I stumbled into the _v_leaves Group attribute, which simplifies the process (no need to figure out if a Node is a Leaf or Group!).
So, no I'm wondering...should I be using the _v_leaves Group attribute to get my Datasets, or iter_nodes() ??
Any insights from more experienced users?
Thanks in advance,
-Ken

Francesc Alted

unread,
Sep 26, 2018, 7:23:32 AM9/26/18
to pytables-users
Hi Ken,

Both approaches are equally valid, but the advantage of the iter_nodes() approach is that you can specify the class ('Table', 'Array', 'Group') of the nodes that are returned.  Performance wise, both ways would be rather similar, I'd say,

Francesc

--
You received this message because you are subscribed to the Google Groups "pytables-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pytables-user...@googlegroups.com.
To post to this group, send email to pytable...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Francesc Alted

Ken Walker

unread,
Sep 26, 2018, 9:48:34 AM9/26/18
to pytables-users
Hi Francesc,
Thanks for the insights. You know that Python saying ("There should be one-- and preferably only one --obvious way to do it").
I am "somewhat new" to HDF5 and PyTables. So, many of my questions are intended to establish the one obvious way to do things for others in the organization (aka "best practices").
Thanks!!
-Ken
Reply all
Reply to author
Forward
0 new messages