Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #84015

Hashed lookups for tabular data

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <jcasale@activenetwerx.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.012
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'model,': 0.05; 'exist,': 0.09; 'rows': 0.09; '"n"': 0.16; 'container.': 0.16; 'containers': 0.16; 'iterable': 0.16; 'lookups': 0.16; 'received:172.18.0': 0.16; 'set,': 0.16; 'simplified': 0.16; 'subject:tabular': 0.16; 'year)': 0.16; 'thanks,': 0.17; 'library': 0.18; 'slightly': 0.19; 'example': 0.22; 'closely': 0.24; 'query': 0.26; 'asking': 0.27; 'container': 0.31; 'grouping': 0.31; 'sets.': 0.31; 'tuples': 0.31; 'cases': 0.33; 'implemented': 0.33; "i'd": 0.34; 'classes': 0.35; 'something': 0.35; 'objects': 0.35; 'but': 0.35; 'there': 0.35; 'accessing': 0.36; 'subject:data': 0.36; 'done': 0.36; 'charset:us-ascii': 0.36; 'similar': 0.36; 'to:addr:python-list': 0.38; 'fact': 0.38; 'expect': 0.39; 'does': 0.39; 'to:addr:python.org': 0.39; 'received:unknown': 0.61; 'length': 0.61; 'providing': 0.61; 'such': 0.63; 'surprise': 0.74; 'utilized': 0.84
X-Cloudmark-SP-Filtered true
X-Cloudmark-SP-Result v=1.1 cv=jhVCqOCcONDhIh1w2GEjcBn40ITekX4NlKMVE0oiDkw= c=1 sm=1 a=CRTDazI5n6YA:10 a=BLceEmwcHowA:10 a=kj9zAlcOel0A:10 a=xqWC_Br6kY4A:10 a=g3mLq75WYuDrh3Lt0JSDww==:17 a=eI4g4inBIJRiI8lf96AA:9 a=CjuIK1q_8ugA:10 a=HpAAvcLHHh0Zw7uRqdWCyQ==:117
X-Spam-Checker-Version SpamAssassin 3.3.2 (2011-06-06) on mail.activenetwerx.com
X-Spam-Level
X-Spam-Status No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2
From "Joseph L. Casale" <jcasale@activenetwerx.com>
To "'python-list@python.org'" <python-list@python.org>
Subject Hashed lookups for tabular data
Thread-Topic Hashed lookups for tabular data
Thread-Index AdAz8ITsOlDb5rdsT/6XGbGmQKKOvA==
Date Mon, 19 Jan 2015 14:13:29 +0000
Accept-Language en-US
Content-Language en-US
X-MS-Has-Attach
X-MS-TNEF-Correlator
x-ms-exchange-transport-fromentityheader Hosted
x-originating-ip [172.18.0.200]
Content-Type text/plain; charset="us-ascii"
Content-Transfer-Encoding quoted-printable
MIME-Version 1.0
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.17852.1421676887.18130.python-list@python.org> (permalink)
Lines 32
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1421676887 news.xs4all.nl 2842 [2001:888:2000:d::a6]:44016
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:84015

Show key headers only | View raw


I have some tabular data for example 3 tuples that I need to build a container
for where lookups into any one of the three fields are O(1). Does something
in the base library exist, or if not is there an efficient implementation of such
a container that has been implemented before I give it a go?

It complicates slightly by the fact that for the some of the collections, one of
the fields may be duplicated, think (make, model, year) for example which
closely resembles the pattern of one the data sets. When asking for position
0 of the set, I'd expect to get an iterable of length "n" but some of the containers
will be inherently unique for the rows that will be accessed so I'd return a single
row.

No surprise the data originates from a database however the data is utilized in
a recursive processing loop where the user accessing the data benefits from a
simplified and quick means to access it. Currently its done with classes that
resemble named tuples equating to a row, but it goes pear shaped with the outer
container. Grouping these similar objects and providing the sql like query into
the collection in some cases is O(n)...

Thanks,
jlc

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Hashed lookups for tabular data "Joseph L. Casale" <jcasale@activenetwerx.com> - 2015-01-19 14:13 +0000

csiph-web