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


Groups > comp.lang.python > #97416

Re: Finding Blank Columns in CSV

References <muttuu$pc5$1@ger.gmane.org> <CAPTjJmrdE-n=VazddU7PZS6E=rbBf1XVoz_g2ArxK6454D5qxw@mail.gmail.com> <CAPTjJmqYwD0=KNLaHu_w_sOjUoacQRXFhb4Zxdv6n++5A-Y8iQ@mail.gmail.com> <20151005090652.1c9faed7@bigbox.christie.dr>
Date 2015-10-06 01:34 +1100
Subject Re: Finding Blank Columns in CSV
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.396.1444055666.28679.python-list@python.org> (permalink)

Show all headers | View raw


On Tue, Oct 6, 2015 at 1:06 AM, Tim Chase <python.list@tim.thechases.com> 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

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


Thread

Re: Finding Blank Columns in CSV Chris Angelico <rosuav@gmail.com> - 2015-10-06 01:34 +1100

csiph-web