[python-win32] Help with data structure
Tim Golden
tim.golden at viacom-outdoor.co.uk
Thu Apr 29 09:14:04 EDT 2004
AW> I would like some advice on appropriate data structures
AW> for a data mining application I have. If not the right
AW> place, please direct me elsewhere, thanks.
Since what you're asking appears to be a general-purpose
Python question, you might get more mileage at comp.lang.python
(or its mirrors, python-list at python.org and
http://groups.google.com/groups?group=comp.lang.python).
Nevertheless...
AW>
type data_type is array (key) of
array1
array2
...
array21
end type
where:-
- key is a combination of four server names,
- array1 to array21 are lists of floating type values representing timing
information.
I use
ky = (a, b, c, d)
data[ky] = ??
already, what I don't get is how to add the array elements.
<AW
I think what you're saying is that you need a dictionary
keyed on four server names whose values are lists of (in
fact 21) floating type values.
I think this is what you're after.
# d is the dictionary - the entire dataset
# the ('a', 'b', 'c', 'd') tuples are the lists of server names - the keys
# the [1.0, ..., 8.9] lists are the floating-point values referring to
timings
# note that the ellipsis isn't syntax: merely my disinclinatino to type 21
values
# if the timing values were only four per list, it would be: [1.0, 2.3,
4.5, 6.7]
d = {}
d[('a', 'b', 'c', 'd')] = [1.0, 2.0, 3.5, 4.6, ..., 8.9]
d[('f', 'g', 'h', 'j')] = [2.0, 4.0, 6.5, 7.6, ..., 9.8]
Have I understood the question?
TJG
________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________
More information about the Python-win32
mailing list