Re: Merge Two List of Dict

2016-12-01 Thread Tim Chase
On 2016-12-01 12:44, Nikhil Verma wrote: > A = [{'person_id': '1', 'adop_count': '2'}, {'person_id': '3', > 'adop_count': '4'}] > *len(A) might be above 10L* > > B = [{'person_id': '1', 'village_id': '3'}, {'person_id': '3', > 'village_id': '4'}] > *len(B) might be above 20L* > > > OutPut List

Fwd: Merge Two List of Dict

2016-12-01 Thread Nikhil Verma
Just editing the count it was from Indian place value notation. -- Forwarded message -- From: Nikhil Verma <varma.nikhi...@gmail.com> Date: Thu, Dec 1, 2016 at 12:44 PM Subject: Merge Two List of Dict To: python-list@python.org Hey guys What is the most optimal and py

Re: Merge Two List of Dict

2016-12-01 Thread Peter Otten
Peter Otten wrote: > If the data stems from a database you can run (untested) > > select B.village_id, sum(A.adop_count) from A inner join B on A.person_id > = B.person_id; > Oops, I forgot the group-by clause: select B.village_id, sum(A.adop_count) from A inner join B on A.person_id =

Re: Merge Two List of Dict

2016-12-01 Thread Peter Otten
Nikhil Verma wrote: > Hey guys > > What is the most optimal and pythonic solution forthis situation > > A = [{'person_id': '1', 'adop_count': '2'}, {'person_id': '3', > 'adop_count': '4'}] > *len(A) might be above 10L* > > B = [{'person_id': '1', 'village_id': '3'}, {'person_id': '3', >

Merge Two List of Dict

2016-11-30 Thread Nikhil Verma
Hey guys What is the most optimal and pythonic solution forthis situation A = [{'person_id': '1', 'adop_count': '2'}, {'person_id': '3', 'adop_count': '4'}] *len(A) might be above 10L* B = [{'person_id': '1', 'village_id': '3'}, {'person_id': '3', 'village_id': '4'}] *len(B) might be above 20L*