Re: Finding empty columns. Is there a faster way?

2011-04-22 Thread nn
On Apr 21, 4:32 pm, Jon Clements wrote: > On Apr 21, 5:40 pm, nn wrote: > > > > > > > > > > > time head -100 myfile  >/dev/null > > > real    0m4.57s > > user    0m3.81s > > sys     0m0.74s > > > time ./repnullsalt.py '|' myfile > > 0 1 Null columns: > > 11, 20, 21, 22, 23, 24, 25, 26, 27, 30

Re: Finding empty columns. Is there a faster way?

2011-04-21 Thread Jon Clements
On Apr 21, 5:40 pm, nn wrote: > time head -100 myfile  >/dev/null > > real    0m4.57s > user    0m3.81s > sys     0m0.74s > > time ./repnullsalt.py '|' myfile > 0 1 Null columns: > 11, 20, 21, 22, 23, 24, 25, 26, 27, 30, 31, 33, 45, 50, 68 > > real    1m28.94s > user    1m28.11s > sys     0m0.

Finding empty columns. Is there a faster way?

2011-04-21 Thread nn
time head -100 myfile >/dev/null real0m4.57s user0m3.81s sys 0m0.74s time ./repnullsalt.py '|' myfile 0 1 Null columns: 11, 20, 21, 22, 23, 24, 25, 26, 27, 30, 31, 33, 45, 50, 68 real1m28.94s user1m28.11s sys 0m0.72s import sys def main(): with open(sys.argv[2

Re: Is there a faster way to do this?

2008-08-06 Thread Boris Borcic
Is your product ID always the 3rd and last item on the line ? Else your output won't separate IDs. And how does output = open(output_file,'w') for x in set(line.split(',')[2] for line in open(input_file)) : output.write(x) output.close() behave ? [EMAIL PROTECTED] wrote: I have a csv fil

Re: Is there a faster way to do this?

2008-08-05 Thread Tomasz Rola
On Tue, 5 Aug 2008, [EMAIL PROTECTED] wrote: > I have a csv file containing product information that is 700+ MB in > size. I'm trying to go through and pull out unique product ID's only > as there are a lot of multiples. My problem is that I am appending the > ProductID to an array and then search

Re: Is there a faster way to do this?

2008-08-05 Thread Roy H. Han
Why not just use sets? a = set() a.add(1) a.add(2) On Tue, Aug 5, 2008 at 10:14 PM, RPM1 <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: >> >> I have a csv file containing product information that is 700+ MB in >> size. I'm trying to go through and pull out unique product ID's only >> as th

Re: Is there a faster way to do this?

2008-08-05 Thread RPM1
[EMAIL PROTECTED] wrote: I have a csv file containing product information that is 700+ MB in size. I'm trying to go through and pull out unique product ID's only as there are a lot of multiples. My problem is that I am appending the ProductID to an array and then searching through that array each

Re: Is there a faster way to do this?

2008-08-05 Thread Gary Herron
Avinash Vora wrote: On Aug 5, 2008, at 10:00 PM, [EMAIL PROTECTED] wrote: I have a csv file containing product information that is 700+ MB in size. I'm trying to go through and pull out unique product ID's only as there are a lot of multiples. My problem is that I am appending the ProductID to

Re: Is there a faster way to do this?

2008-08-05 Thread Avinash Vora
On Aug 5, 2008, at 10:00 PM, [EMAIL PROTECTED] wrote: I have a csv file containing product information that is 700+ MB in size. I'm trying to go through and pull out unique product ID's only as there are a lot of multiples. My problem is that I am appending the ProductID to an array and then sea

Re: Is there a faster way to do this?

2008-08-05 Thread Gary Herron
[EMAIL PROTECTED] wrote: I have a csv file containing product information that is 700+ MB in size. I'm trying to go through and pull out unique product ID's only as there are a lot of multiples. My problem is that I am appending the ProductID to an array and then searching through that array each

Is there a faster way to do this?

2008-08-05 Thread [EMAIL PROTECTED]
I have a csv file containing product information that is 700+ MB in size. I'm trying to go through and pull out unique product ID's only as there are a lot of multiples. My problem is that I am appending the ProductID to an array and then searching through that array each time to see if I've seen t

Re: A Faster Way...

2005-05-11 Thread Fredrik Lundh
"stasz" wrote: > > hmm, there's lots of ways, huh? you can use itertools.zip instead of > > builtin zip, or do: > > > > map(None, list1, list2) > > Not! huh? > One should try a possible solution first, > >>> l1 = range(10) > >>> l2 = range(10,20) > >>> l1 > [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] > >>>

Re: A Faster Way...

2005-05-11 Thread stasz
On Tue, 10 May 2005 18:11:27 -0700, gene.tani wrote: > hmm, there's lots of ways, huh? you can use itertools.zip instead of > builtin zip, or do: > > map(None, list1, list2) Not! One should try a possible solution first, >>> l1 = range(10) >>> l2 = range(10,20) >>> l1 [0, 1, 2, 3, 4, 5, 6, 7, 8

Re: A Faster Way...

2005-05-11 Thread asmir . mehic
For efficient string concatenation in python look at: http://www.skymind.com/~ocrow/python_string -- http://mail.python.org/mailman/listinfo/python-list

Re: A Faster Way...

2005-05-10 Thread gene . tani
hmm, there's lots of ways, huh? you can use itertools.zip instead of builtin zip, or do: map(None, list1, list2) , which will pad the shorter one to match the longer one. -- http://mail.python.org/mailman/listinfo/python-list

Re: A Faster Way...

2005-05-10 Thread Klaus Alexander Seistrup
[EMAIL PROTECTED] wrote: > If I simplify the problem, suppose I have 2 lists like: > > a = range(10) > b = range(20,30) > > What I would like to have, is a "union" of the 2 list in a > single tuple. In other words (Python words...): > > c = (0, 20, 1, 21, 2, 22, 3, 23, 4, 24, 5, 25, . If the

Re: A Faster Way...

2005-05-10 Thread Steven Bethard
[EMAIL PROTECTED] wrote: > If I simplify the problem, suppose I have 2 lists like: > > a = range(10) > b = range(20,30) > > What I would like to have, is a "union" of the 2 list in a single tuple. In > other words (Python words...): > > c = (0, 20, 1, 21, 2, 22, 3, 23, 4, 24, 5, 25, . py> a

Re: A Faster Way...

2005-05-10 Thread Andrew Dalke
andrea.gavana wrote: > If I simplify the problem, suppose I have 2 lists like: > > a = range(10) > b = range(20,30) > > What I would like to have, is a "union" of the 2 list in a single tuple. In > other words (Python words...): > > c = (0, 20, 1, 21, 2, 22, 3, 23, 4, 24, 5, 25, . The 'yiel

Re: A Faster Way...

2005-05-10 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > If I simplify the problem, suppose I have 2 lists like: > > a = range(10) > b = range(20,30) > > What I would like to have, is a "union" of the 2 list in a single tuple. In > other words (Python words...): > > c = (0, 20, 1, 21, 2, 22, 3, 23, 4, 24, 5, 25, . > > and

Re: A Faster Way...

2005-05-10 Thread Bill Mill
On 5/10/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hello NG, > > it is probably a beginner question, but I didn't solve it without > for-loops, and I am unable to determine if there is a faster way (probably > using some built-in function) to do this

A Faster Way...

2005-05-10 Thread andrea . gavana
Hello NG, it is probably a beginner question, but I didn't solve it without for-loops, and I am unable to determine if there is a faster way (probably using some built-in function) to do this task. I have to speed up a wxPython code that uses a lot of string concatenation (and uses