I have list of dictionaries below, and I need to delete dictionaries having the same received_on
and customer_group
values but leave a random one item.
data = [
{
'id': '16e26a4a9f97fa4f',
'received_on': '2019-11-01 11:05:51',
'customer_group': 'Life-time Buyer'
},
{
'id': '16db0dd4a42673e2',
'received_on': '2019-10-09 14:12:29',
'customer_group': 'Lead'
},
{
'id': '16db0dd4199f5897',
'received_on': '2019-10-09 14:12:29',
'customer_group': 'Lead'
}
]
Expected output:
[
{
'id': '16e26a4a9f97fa4f',
'received_on': '2019-11-01 11:05:51',
'customer_group': 'Life-time Buyer'
},
{
'id': '16db0dd4199f5897',
'received_on': '2019-10-09 14:12:29',
'customer_group': 'Lead'
}
]