问题
I have a database like the following, in which the value of the parameter 'b' depends on the values of multiple other parameters, viz. a(1), a(2) ... a(n):
a(1),a(2),a(3),...,a(n) : b
and multiple lines like this. The value of 'n' is also dynamic and varies across various data sets.
What is the best way to construct a lookup table for this kind of data in Python?
One way could be using a nested dictionary with the values of a(i) as i-th level of key, but it seems too cumbersome to create such a dictionary dynamically.
Additional Information
I need the lookup table to find values of the variable b for different combinations of values of a(1), a(2) ... a(n).In many cases the values of a(i) is a range instead of a specific value. and its not a SQL database.
I basically have to loop through the the value set of various a(i) variables and find the appropriate value of the variable 'b' for that particular value set.
example data set:
a(1) a(2) b
1-2 1-2 5-15
1-2 3-4 16-30
3-10 1-4 10-30
来源:https://stackoverflow.com/questions/14725594/how-to-create-a-lookup-table-in-python-when-the-dependent-parameter-value-depend