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


Groups > comp.lang.python > #90653

Re: Looking for direction

X-FeedAbuse http://nntpfeed.proxad.net/abuse.pl feeded by 78.192.65.63
Path csiph.com!usenet.pasdenom.info!nntpfeed.proxad.net!news.muarf.org!news.roellig-ltd.de!open-news-network.org!border2.nntp.ams1.giganews.com!nntp.giganews.com!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <lab@pacbell.net>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.011
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'python.': 0.02; 'python,': 0.02; 'tutorial': 0.03; 'beginner': 0.05; 'column': 0.07; 'duplicate': 0.07; 'needed,': 0.07; 'problem:': 0.07; 'replied': 0.09; 'rows': 0.09; 'rows,': 0.09; 'assume': 0.14; '72k': 0.16; 'appear?': 0.16; 'arent': 0.16; 'before.': 0.16; 'columns': 0.16; 'csv': 0.16; 'dict': 0.16; 'dictionary.': 0.16; 'guessing': 0.16; 'mylist': 0.16; 'preserve': 0.16; 'report)': 0.16; 'say.': 0.16; 'thought.': 0.16; 'tuple': 0.16; 'versatile': 0.16; 'all.': 0.16; 'wrote:': 0.18; 'bit': 0.19; 'not,': 0.20; 'written': 0.21; 'help.': 0.21; 'seems': 0.21; '>>>': 0.22; 'header:User-Agent:1': 0.23; 'merge': 0.24; "shouldn't": 0.24; 'tells': 0.24; 'decide': 0.24; "i've": 0.25; 'compare': 0.26; 'header:In-Reply-To:1': 0.27; 'point': 0.28; 'rest': 0.29; 'external': 0.29; 'said,': 0.30; "i'm": 0.30; 'easier': 0.31; 'accidentally': 0.31; 'ups': 0.31; 'file': 0.32; 'there.': 0.32; 'this.': 0.32; 'probably': 0.32; 'figure': 0.32; 'supposed': 0.32; 'run': 0.32; 'worked': 0.33; 'guess': 0.33; 'lab': 0.33; 'not.': 0.33; 'there,': 0.34; 'could': 0.34; 'problem': 0.35; "can't": 0.35; 'hundreds': 0.35; 'no,': 0.35; 'but': 0.35; 'add': 0.35; 'there': 0.35; 'really': 0.36; 'done,': 0.36; 'in.': 0.36; 'doing': 0.36; 'useful': 0.36; "i'll": 0.36; 'so,': 0.37; 'operating': 0.37; 'turn': 0.37; 'two': 0.37; 'list': 0.37; 'list.': 0.37; 'being': 0.38; 'thank': 0.38; 'lists.': 0.38; 'handle': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'rather': 0.38; 'that,': 0.38; 'short': 0.38; 'realize': 0.39; 'sure': 0.39; 'to:addr:python.org': 0.39; 'enough': 0.39; 'system.': 0.39; 'mailing': 0.39; 'how': 0.40; 'even': 0.60; 'remove': 0.60; 'read': 0.60; 'dave': 0.60; 'received:67.195': 0.60; 'identify': 0.61; 'mentioned': 0.61; 'staff': 0.61; 'simple': 0.61; "you're": 0.61; 'first': 0.61; 'you.': 0.62; 'back': 0.62; "you'll": 0.62; 'more': 0.64; 'accounts': 0.64; 'great': 0.65; 'account': 0.65; 'charset:windows-1252': 0.65; 'life': 0.66; 'here': 0.66; 'dont': 0.67; 'header:Reply-To:1': 0.67; 'importantly,': 0.68; 'received:gq1.yahoo.com': 0.68; 'received:mail.gq1.yahoo.com': 0.68; 'staff.': 0.68; 'reply-to:no real name:2**0': 0.71; 'sale': 0.75; 'comment.': 0.84; 'daunting.': 0.84; "it'd": 0.84; 'mailer': 0.84; 'received:bullet.mail.gq1.yahoo.com': 0.84; 'staff,': 0.84; 'angel': 0.91; 'hundred': 0.95
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=pacbell.net; s=s2048; t=1431619130; bh=M7+DXiWBYTpJN5kVGzvJNxiGv0pyXVDTymrHfwrsLTg=; h=Date:From:Reply-To:To:Subject:References:In-Reply-To:From:Subject; b=pJuC7MV4AA6tOeJzXdodpQWslO5N8LR68oI6kTRjlJ10Yx24JHAo1kS0F38ktfiRSarOALKN0qTwSmSKnBJ7z4u98/fOON8/AQ9stYIDlSAIvUKPp/s3Szt0puW1zGLSI1pAFgsqMd6uzy0oL3gbsLsdabzhUI7WMD3mKHZ5mCq0YAnW1xoavOmlOJ9+wAcG4HYlOjSQ6l+6yP/dkLKYphT6MzDzC53NECE5K46fTnin6wK7XGAtGhMqYd2gYvFVaaAvPNtvnLhNXQCl8uLql+cieW2zizT6xBmwIMtvtj0mzYjHVV6Q2pmPigyPXdh4nltrpdKjUzRMaVLgzZOzPA==
X-Yahoo-Newman-Id 144007.99547.bm@smtp116.sbc.mail.gq1.yahoo.com
X-Yahoo-Newman-Property ymail-3
X-YMail-OSG FvPmjjcVM1naaIw0ahCC6U0Tg15TnZgQAAIdr6yJ9jWKa11 VhBM2G32rw.GehmXdMV4LwdhoCnfB8HyuylR6JYuA_Mz5EH9wOpObihleXCc 7jSVKz1ZDK7X_xCDu_zv7nGbuQVDuR.GDMh99wS6RboeW64_tRGe4yjTW3Qh q.yjFmrTGCIru.5ynOOfQqL35.JRWxtliskLyY1p3ze598vZj7GzJxBJOvBt Z9JC_RwTc5NQs7NnHMwKo65oKf6xRuvl8jCV.mIe.4VwClrViJGv5vJWIzN_ 4gwGMrqg1VqQev4CL9Ppoxm.V65cK30epPEVYg96R2NXiZ.MtyTcFBr8ZafJ HI8NpDX.P0wM6WZ.LfAw6m_X.dl5v9GLxbw4Qpln98eBozO2PC3NA_W5i8Lx unImcQb1Dukxf_SlLmZOEe9Al2M7yiV_QFmDOi1rr_Y2GttC4jYpZ48N0M5s qulUWhLowcGMwQp_YL9D0NOfRZ5Xd.yZO8fMcUEBlLIbCbaAbYBq7QCIaDJ8 aOuRHv0bt8FI39cz77ESq0bHgrWUbMKCqo_k3JDfr
X-Yahoo-SMTP pX5JzlCswBCHjFe3u2nDwDnAKSoAPmfgWieH5g--
Date Thu, 14 May 2015 08:58:48 -0700
From 20/20 Lab <lab@pacbell.net>
Reply-To lab@2020fresno.com
Organization 20/20 Optometric
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0
MIME-Version 1.0
To python-list@python.org
Subject Re: Looking for direction
References <5553DD2E.2080600@pacbell.net> <5553E72B.5000309@davea.name> <5553F695.9040903@davea.name>
In-Reply-To <5553F695.9040903@davea.name>
Content-Type text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding 7bit
X-Mailman-Approved-At Fri, 15 May 2015 09:28:35 +0200
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
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.27.1431674916.17265.python-list@python.org> (permalink)
Lines 95
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1431674916 news.xs4all.nl 2931 [2001:888:2000:d::a6]:40659
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:90653

Show key headers only | View raw



On 05/13/2015 06:12 PM, Dave Angel wrote:
> On 05/13/2015 08:45 PM, 20/20 Lab wrote:>
>
> You accidentally replied to me, rather than the mailing list. Please 
> use reply-list, or if your mailer can't handle that, do a Reply-All, 
> and remove the parts you don't want.
>
> >
> > On 05/13/2015 05:07 PM, Dave Angel wrote:
> >> On 05/13/2015 07:24 PM, 20/20 Lab wrote:
> >>> I'm a beginner to python.  Reading here and there. Written a 
> couple of
> >>> short and simple programs to make life easier around the office.
> >>>
> >> Welcome to Python, and to this mailing list.
> >>
> >>> That being said, I'm not even sure what I need to ask for. I've never
> >>> worked with external data before.
> >>>
> >>> I have a LARGE csv file that I need to process.  110+ columns, 72k
> >>> rows.
> >>
> >> That's not very large at all.
> >>
> > In the grand scheme, I guess not.  However I'm currently doing this
> > whole process using office.  So it can be a bit daunting.
>
> I'm not familiar with the "office" operating system.
>
> >>>  I managed to write enough to reduce it to a few hundred rows, and
> >>> the five columns I'm interested in.
> >>
> >>>
> >>> Now is were I have my problem:
> >>>
> >>> myList = [ [123, "XXX", "Item", "Qty", "Noise"],
> >>>             [72976, "YYY", "Item", "Qty", "Noise"],
> >>>             [123, "XXX" "ItemTypo", "Qty", "Noise"]    ]
> >>>
> >>
> >> It'd probably be useful to identify names for your columns, even if
> >> it's just in a comment.  Guessing from the paragraph below, I figure
> >> the first two columns are "account" & "staff"
> >
> > The columns that I pull are Account, Staff, Item Sold, Quantity sold,
> > and notes about the sale (notes arent particularly needed, but the
> > higher ups would like them in the report)
> >>
> >>> Basically, I need to check for rows with duplicate accounts row[0] 
> and
> >>> staff (row[1]), and if so, remove that row, and add it's Qty to the
> >>> original row.
> >>
> >> And which column is that supposed to be?  Shouldn't there be a number
> >> there, rather than a string?
> >>
> >>> I really dont have a clue how to go about this.  The
> >>> number of rows change based on which run it is, so I couldnt even get
> >>> away with using hundreds of compare loops.
> >>>
> >>> If someone could point me to some documentation on the functions I 
> would
> >>> need, or a tutorial it would be a great help.
> >>>
> >>
> >> Is the order significant?  Do you have to preserve the order that the
> >> accounts appear?  I'll assume not.
> >>
> >> Have you studied dictionaries?  Seems to me the way to handle the
> >> problem is to read in a row, create a dictionary with key of (account,
> >> staff), and data of the rest of the line.
> >>
> >> Each time you read a row, you check if the key is already in the
> >> dictionary.  If not, add it.  If it's already there, merge the data as
> >> you say.
> >>
> >> Then when you're done, turn the dict back into a list of lists.
> >>
> > The order is irrelevant.  No, I've not really studied dictionaries, but
> > a few people have mentioned it.  I'll have to read up on them and, more
> > importantly, their applications.  Seems that they are more versatile
> > then I thought.
> >
> > Thank you.
>
> You have to realize that a tuple can be used as a key, in your case a 
> tuple of Account and Staff.
>
> You'll have to decide how you're going to merge the ItemSold, 
> QuantitySold, and notes.
>
Tells you how often I actually talk in mailing lists.  My apologies, and 
thank you again.

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


Thread

Re: Looking for direction 20/20 Lab <lab@pacbell.net> - 2015-05-14 08:58 -0700

csiph-web