RE: Data structure question

2013-11-17 Thread Joseph L. Casale
> How about two dictionaries, each containing the same tuples for > values? If you create a tuple first, then add it to both dicts, you > won't have any space-wasting duplicates. Thanks guys. -- https://mail.python.org/mailman/listinfo/python-list

Re: Data structure question

2013-11-17 Thread Dave Angel
On Mon, 18 Nov 2013 02:03:38 +, "Joseph L. Casale" wrote: I have a need for a script to hold several tuples with three values, two text strings and a lambda. I need to index the tuple based on either of the two strings. Normally a database would be ideal but for a self-contained script

RE: Data structure question

2013-11-17 Thread Joseph L. Casale
> Not entirely sure I understand you, can you post an example? > > If what you mean is that you need to locate the function (lambda) when > you know its corresponding strings, a dict will suit you just fine. > Either maintain two dicts for the two separate strings (eg if they're > "name" and "loca

Re: Data structure question

2013-11-17 Thread Ned Batchelder
On Sunday, November 17, 2013 9:03:38 PM UTC-5, Joseph L. Casale wrote: > I have a need for a script to hold several tuples with three values, two text > strings and a lambda. I need to index the tuple based on either of the two > strings. Normally a database would be ideal but for a self-contained

Re: Data structure question

2013-11-17 Thread Chris Angelico
On Mon, Nov 18, 2013 at 1:03 PM, Joseph L. Casale wrote: > I have a need for a script to hold several tuples with three values, two text > strings and a lambda. I need to index the tuple based on either of the two > strings. Normally a database would be ideal but for a self-contained script > that

Re: Data structure question

2013-11-17 Thread Tim Chase
On 2013-11-18 02:03, Joseph L. Casale wrote: > I have a need for a script to hold several tuples with three > values, two text strings and a lambda. I need to index the tuple > based on either of the two strings. Normally a database would be > ideal but for a self-contained script that's a bit much

Data structure question

2013-11-17 Thread Joseph L. Casale
I have a need for a script to hold several tuples with three values, two text strings and a lambda. I need to index the tuple based on either of the two strings. Normally a database would be ideal but for a self-contained script that's a bit much. Before I re-invent the wheel, are there any built-

Re: How to store "3D" data? (data structure question)

2005-07-20 Thread Sebastian Bassi
On 7/20/05, Cyril Bazin <[EMAIL PROTECTED]> wrote: > The question of the type of the data sutructure depends of your use of the > data. > You could avoid some confusion without naming your columns "lines"... Yes, that is because they are "plant lines", that is why is called "lines" :) > Anyway

Re: How to store "3D" data? (data structure question)

2005-07-20 Thread Cyril Bazin
The question of the type of the data sutructure depends of your use of the data. You could avoid some confusion without naming your columns "lines"... Anyway, here is a piece of code that read the file and count the star on the fly: (The result is a dict of dict of int.)

Re: How to store "3D" data? (data structure question)

2005-07-20 Thread Sebastian Bassi
On 20 Jul 2005 11:51:56 -0700, Graham Fawcett <[EMAIL PROTECTED]> wrote: > You get the idea: model the data in the way that makes it most useable > to you, and/or most efficient (if this is a large data set). I don't think this could be called a large dataset (about 40Kb all the file). It would b

Re: How to store "3D" data? (data structure question)

2005-07-20 Thread Graham Fawcett
181 and Line RHA801. Okay. I think what will drive your data-structure question is the way that you intend to use the data. Conceptually, it will always be 3D, no matter how you model it, but trying to make a "3D data structure" is probably not what is most efficient for your application.

Re: How to store "3D" data? (data structure question)

2005-07-20 Thread Sebastian Bassi
On 20 Jul 2005 10:47:50 -0700, Graham Fawcett <[EMAIL PROTECTED]> wrote: > # zip is your friend here. It lets you iterate > # across your line names and corresponding values > # in parallel. This zip function is new to me, the only zip I knew was pkzip :). So will read about it. --

Re: How to store "3D" data? (data structure question)

2005-07-20 Thread Sebastian Bassi
On 20 Jul 2005 10:47:50 -0700, Graham Fawcett <[EMAIL PROTECTED]> wrote: > This looks a lot like 2D data (row/column), not 3D. What's the third > axis? It looks, too, that you're not really interested in storage, but > in analysis... I think it as 3D like this: 1st axis: [MARKER]Name, like TDF1,

Re: How to store "3D" data? (data structure question)

2005-07-20 Thread Graham Fawcett
Sebastian Bassi wrote: > Hello, > > I have to parse a text file (was excel, but I translated to CSV) like > the one below, and I am not sure how to store it (to manipulate it > later). > > Here is an extract of the data: > [snip] This looks a lot like 2D data (row/column), not 3D. What's the third

How to store "3D" data? (data structure question)

2005-07-20 Thread Sebastian Bassi
Hello, I have to parse a text file (was excel, but I translated to CSV) like the one below, and I am not sure how to store it (to manipulate it later). Here is an extract of the data: Name,Allele,RHA280,RHA801,RHA373,RHA377,HA383 TDF1,181, ,188, ,190, ,193,*,*,,, ,None,,,*,*,* ,,