Path: csiph.com!au2pb.net!feeder.erje.net!1.eu.feeder.erje.net!border1.nntp.ams1.giganews.com!nntp.giganews.com!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!nzpost1.xs4all.net!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.040 X-Spam-Evidence: '*H*': 0.92; '*S*': 0.00; 'difference,': 0.07; 'cc:addr:python-list': 0.09; 'csv': 0.09; 'subject:CSV': 0.09; 'assume': 0.11; 'columns': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'wrote:': 0.16; '2015': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'am,': 0.23; 'tim': 0.24; 'header:In-Reply-To:1': 0.24; 'message-id:@mail.gmail.com': 0.27; '(maybe': 0.29; 'chase': 0.29; 'sure,': 0.29; 'knows': 0.32; 'tue,': 0.34; 'file': 0.34; 'list': 0.34; 'received:google.com': 0.35; 'but': 0.36; 'there': 0.36; 'subject:: ': 0.37; 'means': 0.39; 'some': 0.40; 'easy': 0.60; 'your': 0.60; 'determine': 0.61; 'entire': 0.61; 'million': 0.74; 'chrisa': 0.84; "there'll": 0.84; 'whatsoever.': 0.84; 'to:none': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=f+4qsMyFz9+PJawTMLgjZFNVdiQa3gUTU6a2QopDW/Q=; b=U3z4hw/EYN6g/+lVt0WSNvjGHlRnsVPJhycVxlPBQxupGGQxCwZcyUpaildV1BZ+GB kujOIvTovpeBBwomyajVmQZ/pXx+l7cW6xh+iPj1FH2u1wowG1ad217L9ZXVM6HBWFGI ptjt+bPSM1DVx1f6VhpE8mwuA2A9wf2CDdZvU4pzzeNLEnhwJtgote/Mu4m/YqTVWDg5 ywE38p7OEr5dDm/KjFKRk//S/013mNiEdfWWR8eAgiWDOEYKuLOnuRP3lN7K+uGoXM5k GUuBMKijG9oSAcNZeNHfSmNaC8TOh8TqluzwZj48Omo1T+ab3Tv31+8HYTX0x0Td/9z3 QB+Q== MIME-Version: 1.0 X-Received: by 10.50.154.1 with SMTP id vk1mr10427380igb.92.1444055657047; Mon, 05 Oct 2015 07:34:17 -0700 (PDT) In-Reply-To: <20151005090652.1c9faed7@bigbox.christie.dr> References: <20151005090652.1c9faed7@bigbox.christie.dr> Date: Tue, 6 Oct 2015 01:34:17 +1100 Subject: Re: Finding Blank Columns in CSV From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 15 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1444055666 news.xs4all.nl 23836 [2001:888:2000:d::a6]:55188 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:97416 On Tue, Oct 6, 2015 at 1:06 AM, Tim Chase wrote: > That way, if you determine by line 3 that your million-row CSV file > has no blank columns, you can get away with not processing all > million rows. Sure, although that effectively means the entire job is moot. I kinda assume that the OP knows that there are some blank columns (maybe lots of them). The extra check is unnecessary unless it's actually plausible that there'll be no blanks whatsoever. Incidentally, you have an ordered_headers list which is the blank columns in order; I think the OP was looking for a list of the _non_blank columns. But that's a trivial difference, easy to tweak. ChrisA