def group_list_of_dict(array):
 result = defaultdict(list)
 for item in array:
  for (key, value) in item.items():
   result[key] += (value if isinstance(value, list) else [value])
 return result

def group_list_of_dict ( array ) : result = defaultdict ( list ) for item in array : for ( key , value ) in item . items ( ) : result [ key ] += ( value if isinstance ( value , list ) else [ value ] ) return result
helper method to group list of dict to dict with all possible values .