Hey Tom,
I am not sure what you are asking is possible. I don't think sets are
regular enough* container type. Perhaps if you had a sets of consistent (or
maximal) length and primitive data type, this kind of thing would be
possible. (Eg every set in your column only contained integers and has less
than or equal to 10 elements.) However, this is functionally equivalent to
an array**.
If you need the data in set form why not use something like the following:
for row in table:
s = set(row['col_name'])
Additionally, you could store a set as an attribute on a Node (
http://www.pytables.org/docs/manual/ch04.html#AttributeSetClassDescr) or
perhaps you could try storing set definitions or pickled sets in a series of
filenodes (http://www.pytables.org/docs/manual/ch06.html). It should be
noted that either of these methods will likely be slower than the array/set
idea.
Be Well
Anthony
*ie you can't memory map into a set the same way that you can an array.
Elements of a set can be anywhere in memory. Elements of an array
are guaranteed to be available sequentially.
**You could probably hack an array column that reads out into a set
automatically, rather than a numpy array. However, it would still be stored
under the covers as an array, and thus subject to all the array-constraints.
On Sun, Jan 30, 2011 at 7:20 AM, Tom Fawcett <tom.fawc...@gmail.com> wrote:
> Hi. I recently discovered pytables, and I’m impressed with its speed and
> flexibility. But there’s one feature I’d like and I can’t figure out how
> whether pytables can do it.
>
> I’d like to have essentially a set-valued column in a table. I’d like a
> column data type that is very similar to a Python set. I’m not sure how to
> achieve this naturally with pytables – it looks like none of the Cols
> subclasses can be variable length. Any ideas?
>
> Thanks,
> -Tom
>
> ------------------------------------------------------------------------------
> Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
> Finally, a world-class log management solution at an even better
> price-free!
> Download using promo code Free_Logger_4_Dev2Dev. Offer expires
> February 28th, so secure your free ArcSight Logger TODAY!
> http://p.sf.net/sfu/arcsight-sfd2d
> _______________________________________________
> Pytables-users mailing list
> Pytables-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/pytables-users
>
------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires
February 28th, so secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
Pytables-users mailing list
Pytables-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pytables-users