For example I have list of four dictionaries like
[{'username': 'xyz', 'label':'chemistry', 'marks': 56},
{'username': 'abc', 'label':'chemistry', 'marks': 95},
{'username': 'xyz', 'label':'math', 'marks': 43},
{'username': 'abc', 'label':'math', 'marks': 87}]
I want transform the data so that I can get data as
[{'username': 'xyz', 'chemistry': 56, 'math': 43},
{'username': 'abc', 'chemistry': 95, 'math': 87}]