Re: memory usage multi value hash

2011-04-15 Thread Peter Otten
Terry Reedy wrote: > On 4/14/2011 12:55 PM, Peter Otten wrote: > >> I don't expect that it matters much, but you don't need to sort your data >> if you use a dictionary anyway: > > Which means that one can build the dict line by line, as each is read, > instead of reading the entire file into me

Re: memory usage multi value hash

2011-04-15 Thread Algis Kabaila
is taken as follows: A, 1 B, 3 C, 9 A, 2 B, 4 C, 10 A, 3 C, 11 C, 12 C, 90 C, 34 C, 322 C, 21 The "two in one" program is: #!/usr/bin python '''generate.py - Example of reading long two column csv list and sorting. Thread "memory usage multi value hash" '&#x

Re: memory usage multi value hash

2011-04-14 Thread Terry Reedy
On 4/14/2011 12:55 PM, Peter Otten wrote: I don't expect that it matters much, but you don't need to sort your data if you use a dictionary anyway: Which means that one can build the dict line by line, as each is read, instead of reading the entire file into memory. So it does matter for int

Re: memory usage multi value hash

2011-04-14 Thread Peter Otten
christian wrote: > Hello, > > i'm not very experienced in python. Is there a way doing below more > memory efficient and maybe faster. > I import a 2-column file and then concat for every unique value in > the first column ( key) the value from the second > columns. > > So The ouptut is someth

memory usage multi value hash

2011-04-14 Thread christian
Hello, i'm not very experienced in python. Is there a way doing below more memory efficient and maybe faster. I import a 2-column file and then concat for every unique value in the first column ( key) the value from the second columns. So The ouptut is something like that. A,1,2,3 B,3,4 C,9,10,