Lookup values from one table to another based on a value

Discussion in 'Python' started by Bruno Desthuilliers, Sep 20, 2007.

  1. a écrit :
    (snip)
    >
    > If I flipped the Table being looked up not to repeat, would that make
    > things easier to look up a value in?


    Don't repeat informations.
    Bruno Desthuilliers, Sep 20, 2007
    #1
    1. Advertising

  2. Bruno Desthuilliers

    Guest

    If I wanted to accomplish looking up values from one table based on a
    value from another table or file, how would I go about doing this in
    Python? Would I build a dictionary or an array?

    exp:

    Table1:

    Site = 103
    Lane = 2
    Dir = ? # Get this from Table2

    Table2:

    Site, Lane, Direction,
    103, 1, 1
    103, 2, 1
    103, 3, 5
    103, 4, 5

    Normally in Access I would just use a Dlookup and be done with it, or
    use a Recordset in VB. Thanks guys.

    Kou
    , Sep 20, 2007
    #2
    1. Advertising

  3. a écrit :
    > If I wanted to accomplish looking up values from one table based on a
    > value from another table or file, how would I go about doing this in
    > Python? Would I build a dictionary or an array?
    >
    > exp:
    >
    > Table1:
    >
    > Site = 103
    > Lane = 2
    > Dir = ? # Get this from Table2
    >
    > Table2:
    >
    > Site, Lane, Direction,
    > 103, 1, 1
    > 103, 2, 1
    > 103, 3, 5
    > 103, 4, 5
    >
    > Normally in Access I would just use a Dlookup and be done with it, or
    > use a Recordset in VB. Thanks guys.


    What about using a database ? Like SQLite ?

    Else, the canonical data structure for quick lookups is of course the dict.
    Bruno Desthuilliers, Sep 20, 2007
    #3
  4. Bruno Desthuilliers

    Guest

    On Sep 20, 10:34 am, Bruno Desthuilliers <bruno.
    > wrote:
    > a écrit :
    >
    >
    >
    >
    >
    > > If I wanted to accomplish looking up values from one table based on a
    > > value from another table or file, how would I go about doing this in
    > > Python? Would I build a dictionary or an array?

    >
    > > exp:

    >
    > > Table1:

    >
    > > Site = 103
    > > Lane = 2
    > > Dir = ? # Get this from Table2

    >
    > > Table2:

    >
    > > Site, Lane, Direction,
    > > 103, 1, 1
    > > 103, 2, 1
    > > 103, 3, 5
    > > 103, 4, 5

    >
    > > Normally in Access I would just use a Dlookup and be done with it, or
    > > use a Recordset in VB. Thanks guys.

    >
    > What about using a database ? Like SQLite ?
    >
    > Else, the canonical data structure for quick lookups is of course the dict.- Hide quoted text -
    >
    > - Show quoted text -



    Ah, yes, that would appear to be a better means to retrieve data. I
    visited the site, which version should I download? Thanks.

    Kou
    , Sep 20, 2007
    #4
  5. a écrit :
    > On Sep 20, 10:34 am, Bruno Desthuilliers <bruno.
    > > wrote:
    >> a écrit :

    (snip)
    >>> Normally in Access I would just use a Dlookup and be done with it, or
    >>> use a Recordset in VB. Thanks guys.


    >> What about using a database ? Like SQLite ?

    >
    > Ah, yes, that would appear to be a better means to retrieve data. I
    > visited the site, which version should I download? Thanks.


    The latest, unless you have reasons to choose an old one !-)
    Bruno Desthuilliers, Sep 20, 2007
    #5
  6. Bruno Desthuilliers

    Guest

    On Sep 20, 11:51 am, Bruno Desthuilliers <bruno.
    > wrote:
    > a écrit :
    >
    > > On Sep 20, 10:34 am, Bruno Desthuilliers <bruno.
    > > > wrote:
    > >> a écrit :

    > (snip)
    > >>> Normally in Access I would just use a Dlookup and be done with it, or
    > >>> use a Recordset in VB. Thanks guys.
    > >> What about using a database ? Like SQLite ?

    >
    > > Ah, yes, that would appear to be a better means to retrieve data. I
    > > visited the site, which version should I download? Thanks.

    >
    > The latest, unless you have reasons to choose an old one !-)



    If I flipped the Table being looked up not to repeat, would that make
    things easier to look up a value in?

    Exp:

    Table1

    Site = 103
    Lane = 1
    Direction = ?
    FHWA Lane = ?

    Table2

    Site, Lane 1, Direction 1, FHWA Lane 1,
    103, 1, 1, 1
    , Sep 20, 2007
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. leon
    Replies:
    0
    Views:
    419
  2. hangar18
    Replies:
    0
    Views:
    120
    hangar18
    Mar 22, 2006
  3. Robert Cohen
    Replies:
    3
    Views:
    246
    Andrew Durstewitz
    Jul 15, 2003
  4. PT
    Replies:
    1
    Views:
    373
    Ken Schaefer
    Oct 7, 2004
  5. TeknoShock
    Replies:
    1
    Views:
    138
Loading...

Share This Page