Sort a list of dictionaries while consolidating duplicates in Python?
So I have a list of dictionaries like so:
data = [ {
'Organization' : '123 Solar',
'Phone' : '444-444-4444',
'Email' : '',
'website' : 'www.123solar.com'
}, {
'Organization' : '123 Solar',
'Phone' : '',
'Email' : 'joey@123solar.com',
'Website' : 'www.123solar.com'
}, {
etc...
} ]
Of course, this is not the exact data. But (maybe) from my example here
you can catch my problem. I have many records with the same "Organization"
name, but not one of them has the complete information for that record.
Is there an efficient method for searching over the list, sorting the list
based on the dictionary's first entry, and finally merging the data from
duplicates to create a unique entry? (Keep in mind these dictionaries are
quite large)
No comments:
Post a Comment