I want to group the Calculated value list according to level and have sum of that parameter.I was able to get the calculated value from the list but could not able to group it and sum it up
i got it working with def combine_lists(list1, list2):
result =
occurrences = defaultdict(list)
# Group the occurrences of each element in list1
for elem, num in zip(list1, list2):
occurrences[elem].append(num)
# Create the result list with the grouped elements and their occurrences
for elem, nums in occurrences.items():
result.append([elem] + nums)
return result